In this section, we will discuss two custom services. One service focuses on exposing data from Microsoft Dynamics AX 2012 while the other focuses on exposing business logic.
We will use the CVRTitleService
service as an example to demonstrate how to create a simple yet powerful service. This service will allow an external program to do the following two things:
Retrieve the details of a title based on its ID
Retrieve a list of all titles
Let's start by creating a new class for the data contract that will contain the data for one title. Create a new class and name it CVRTitleContract
. In the class declaration, add DataContractAttribute
to specify that the class is a data contract. Also, declare the variable's ID, name, and description, as shown in the following code snippet:
[DataContractAttribute('Title')] public class CVRTitleDataContract { CVRTitleId id; CVRTitleName name; Description description...