Connecting to Dynamics 365 from other systems using .NET
In this recipe, we will cover a simple data access layer that allows you to connect to Dynamics 365 from an external .NET application using the Dynamics 365 SDK.
Getting ready
To get going with this recipe, you will require a Visual Studio IDE and the Dynamics CRM NuGet packages to access the SDK libraries. Alternatively, you can download the SDK and reference the assembly manually.
If you want to use the unit of work pattern using the organization service context, you will also need to generate the early bound classes with an organization service context. Refer to the Creating early bound entity classes recipe of Chapter 3, SDK Enterprise Capabilities, for further details.
How to do it...
- Create or reuse a new C# library solution in Visual Studio called
Packt.Xrm.Extensions
. - Create a new public class called
Dynamics365DataAccessLayer.
- Right-click on the
References
and click onManage NuGet Packages
. Search and installMicrosoft.CrmSdk.XrmTooling...