Where is CrmOrganizationServiceContext for CRM 2016 (8.x) SDK?
Asked Answered
G

0

9

I'm migrating code from SDK for Dynamics CRM 2015 to the latest version which is for 2016 and 365. However, I have noticed that the generated XrmServiceContext is inheriting from Microsoft.Xrm.Sdk.Client.OrganizationServiceContext instead of Microsoft.Xrm.Client.CrmOrganizationServiceContext. That removed the automatic lazy loading of related entities on CrmOrganizationServiceContext. I wasted hours trying to find out why the related entities were empty while the code compiles correctly. I have found that the Microsoft.Xrm.Client has been removed from the 8.x SDK. Does anyone know if the CrmOrganizationServiceContext have been moved/renamed to something else or it was simply removed? Is there alternatives for that lazy loading support? Don't want to find all the places related entities are directly used and add a LoadProperty to it. Thanks.

Gurgitation answered 9/5, 2017 at 2:39 Comment(3)
I eventually end up creating my own Entity and ServiceContext wrappers to add back this lazy loading feature. I created this github repo: github.com/ZapTechnology/XrmLazyLoading. It is much lighter weighted than the original CrmOrganizationServiceContext and only depends on Microsoft.CrmSdk.CoreAssembliesGurgitation
Did you find out anything interesting?Ecclesiastes
@Ecclesiastes see my comment above for the wrapper solution to bring the lazy loading back.Gurgitation

© 2022 - 2024 — McMap. All rights reserved.