Getting a ServiceClient from XrmFakedContext #29
-
Carrying on the discussion from here: jordimontana82/fake-xrm-easy#581 @jordimontana82 I am using this newer version, I started the discussion on the above thread as it felt more relevant. I have gone through the wiki links you shared on the previous discussion and I am no closer to solving the issue I am facing, maybe because I am a newbie in the dynamics world. Here is what my code looks like
` So, how do I solve this issue? All the wikis for this new repo deal only with IOrgnaizationService, I haven't seen one with ServiceClient. PS: Regarding the license, we are still evaluating if this is the correct tool for us. If we decide it is, we will work on the licensing part. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 10 replies
-
Hi @sandeep-chinni , There's no need to use Moq since ServiceClient already implements IOrganizationService/2. You need to refactor your azure function code to either use IOrganizationService or IOrganizationService2, then pass your ServiceClient instance into those methods. Doing it that way there is no need to cast anything as ServiceClient already implements those interfaces. WIth FakeXrmEasy you could use IOrganizationService, IOrganizationServiceAsync, or IOrganizationServiceAsync2 interfaces. Suggest starting with specific documentation about version 3: A specific section for AzureFunctions: https://dynamicsvalue.github.io/fake-xrm-easy-docs/quickstart/azure-functions/. In there you'll find a repo with sample code. And how to use the Async interface: https://dynamicsvalue.github.io/fake-xrm-easy-docs/quickstart/advanced/async/ Hope this helps. |
Beta Was this translation helpful? Give feedback.
Hi @sandeep-chinni ,
There's no need to use Moq since ServiceClient already implements IOrganizationService/2. You need to refactor your azure function code to either use IOrganizationService or IOrganizationService2, then pass your ServiceClient instance into those methods. Doing it that way there is no need to cast anything as ServiceClient already implements those interfaces.
WIth FakeXrmEasy you could use IOrganizationService, IOrganizationServiceAsync, or IOrganizationServiceAsync2 interfaces.
Suggest starting with specific documentation about version 3:
A specific section for AzureFunctions: https://dynamicsvalue.github.io/fake-xrm-easy-docs/quickstart/azure-functions/. In there you…