0
votes

am working on application which all the master data from CRM entities seperately using Microsoft.Xrm.Sdk (CRM web service). Issue is, currently we are calling all entities seperately, which makes WCF call earch time.

I am trying to implement solution, in which I will call seperate entities in one go, so that in 1 WCF call I have all the master data.

So Sql Equivalent will be Select x from Entity1; Select y from Entity2

I am using QueryExpression & then calling RetrieveMultiple(query) method.

I found http://msdn.microsoft.com/en-us/library/jj863604.aspx, which says that I can use Multiple request, but I also found it is used for Create, Update, Delete & Not for Select.

Can you please guide what all option I can go for.

2

2 Answers

1
votes

It is not possible to execute multiple retrieve calls in one message. The execute multiple message that you found is only for doing things to a record not reading them. It is possible to join entities together but I'm not sure that it will help you.

Another option is to read from the SQL database directly, this is supported if you use the filtered views. This will generally be faster

1
votes

Kevin is mostly correct as far as wanting to retrieve from multiple entities with a single WCF call. The best you can probably do is join some entities together.

If you're primarily worried about speed, more so than the number of WCF calls, you can do it multi-threaded. You'll just need to make sure that you have a separate IOrganizationService per thread and that you have increased the maximum number of connections to a remote machine:

<system.net>
  <connectionManagement>
    <add address="*" maxconnection="100" />
  </connectionManagement>
</system.net>

If on the other hand, you are truly concerned about the number of WCF calls, you can put all of your code in either a plugin or a workflow. Once you are in the context of a plugin or workflow, any calls to CRM via the IOrganizationService will not use a WCF call since it is already on the server. This adds a lot of processing overhead to your CRM servers so just beware.