3

I started to develop an ASP .NET MVC website that connects to Dynamics 365 implementation.

The way I connect to Dynamics 365 is by using a separate Data Access Layer in my MVC website that make calls to Dynamics 365 every time I wanted to retrieve/create/update entity.

So every time I wanted to retrieve, for example, a list of Contacts from Dynamics, I will create an instance of OrganizationService using CRMServiceClient class from the SDK, and use it to query the CRM.

If, in another time I needed to update an entity, I will again made an instance of OrganizationService and use it to update the data in CRM.

Basically, every operation I will always create an instance of OrganizationService and query the CRM.

Is this the right way to do it? Are there any other approaches that I can take that can have better performance?

4

1 回答 1

4

You are probably better off creating the OrganizationService once, then storing it in the application state. I don't have any empirical evidence for this, but I believe creating the service object can take a while.

Adxstudio (who created Microsoft CRM portals before they were acquired by Microsoft) also used a cache layer for data retrieved from CRM, to reduce the number of queries sent to CRM and improve overall performance.

Probably worth profiling the performance of both of these to see if the additional effort in storing the objects in memory is worth it in your scenario.

于 2017-07-03T09:52:52.760 回答