TechNet
Export (0) Print
Expand All

The programming models for Microsoft Dynamics CRM

 

Applies To: CRM 2016 on-prem, CRM Online

Microsoft Dynamics CRM offers several programming models designed to give you the flexibility to decide what works best for your needs.

The following diagram illustrates the key programmability scenarios for Microsoft Dynamics CRM Online 2016 Update and Microsoft Dynamics CRM 2016 (on-premises). Use the appropriate Microsoft Dynamics CRM programming models for the type of solutions you create.

Programmability Scenarios for CRM 2016

When you write clients to access data in Microsoft Dynamics CRM you have two options: you can use the Web API or the organization service.

The Web API was introduced with Microsoft Dynamics CRM 2016 and it provides a development experience that can be used across a wide variety of programming languages, platforms, and devices. The Web API implements the OData (Open Data Protocol) v4. OData is an OASIS standard for building and consuming RESTful APIs over rich data sources.

When you use the Web API, you can choose from a list of community-supported libraries that support the OData v4 standard. You can also choose to write code using HTTP directly. More information: Use the Microsoft Dynamics CRM Web API

When you connect to Microsoft Dynamics CRM Online or on-premises environments with Internet-facing deployment (IFD), you can use Azure AD Authentication Libraries (ADAL) to enable authentication from a wide variety of programming languages and platforms. More information: Authenticate to Microsoft Dynamics CRM with the Web API

System_CAPS_noteNote

The organization data service (or OData endpoint) is an OData v2 service that was deprecated in Microsoft Dynamics CRM 2016 in favor of the Web API. The organization data service isn’t included in the preceding diagram. The organization service is still available to support code that used it. However, for any new development for Microsoft Dynamics CRM 2016 we recommend using the Web API. More information: Use the OData endpoint with web resources

If you are a .NET developer you can use either the Web API or the organization service. With the organization service you can use a set of assemblies and tools to generate strongly typed classes that include custom entities and attributes that have been added to an instance of Microsoft Dynamics CRM.

With SDK assemblies and tools for code generation you can also include an OrganizationServiceContext, which is based on the same concept as the DataServiceContext in Windows Communication Foundation (WCF) Data Services. This class lets you track changes, manage identities and relationships, and gives you access to the Microsoft Dynamics CRM .NET Language-Integrated Query (LINQ) provider so you can build queries using LINQ. When you use the tools for code generation, you get strongly typed classes for entities and attributes that are defined when the code generation tool is run. These are called early-bound classes. More information:Use the early bound entity classes in code

When your code needs to work with entities and attributes that weren’t known at the time that the code generation tools were run, you can use an Entity class that allows for specifying entities and entity attribute in your code. This late-bound style of writing code provides greater flexibility but doesn’t allow for compile-time checking of all types so that no implicit casts occur. Late binding checks types only when the object is created or an action is performed on the type. The Entity class requires types to be explicitly specified to prevent implicit casts. More information: Use the late bound entity class in code

If you create a Windows client or are using Windows PowerShell, Xrm.Tooling provides a set of APIs that use the SDK assemblies to provide additional capabilities and resources specifically for Windows client development. More information: Build Windows client applications using the XRM tools

You can write code that listens for events and applies custom business logic to modify or augment the standard behavior of the platform. This code is only available to be written using .NET managed code and the developer experience is based on the same objects defined in the SDK assemblies. You can work with the organization service to perform operations with Microsoft Dynamics CRM data. More information: Write plug-ins to extend business processes.

You can also create custom processes based on the Windows Workflow Foundation programming model. You can create several different types of processes. Most of the time you’ll use the workflow designer. But when there is some capability you can’t achieve in the designer, you can define processes using code. More information: Write workflows to automate business processes

Each of the client applications provided by Microsoft Dynamics CRM includes the ability to define customizations and deploy to multiple types of clients. The web application, Microsoft Dynamics CRM for Outlook, CRM for tablets, and CRM for phones each provide capabilities to include custom navigation and command options as well as the Xrm.Page object model and Xrm.Utility functions you can use with JavaScript to provide responsive experiences in the client. JavaScript libraries, HTML pages, images, and other types of files that can be used or displayed in the client are available as URL addressable web resources. More information: Use JavaScript with Microsoft Dynamics CRM and Web resources for Microsoft Dynamics CRM.

When you need to access Microsoft Dynamics CRM data that isn’t available in the context where your JavaScript code is running, you can make calls to the server to get the data you need. The organization service can be used, but it is much easier to use the Web API with JSON rather than the XML required by the organization service. Because your script runs in the context of the application, you are automatically authenticated. More information: Use the Web API with web resources

Microsoft Dynamics CRM 2016 and CRM Online

© 2016 Microsoft. All rights reserved. Copyright

Community Additions

Show:
© 2016 Microsoft