Creating an entity in version 1.0

This example shows how to create an entity using the CRM entity class created earlier:

 

CrmControllerFactory factory = CrmControllerFactory.Instance;
CrmEntityController<CrmContact> crmContactController = factory.GetEntityController<CrmContact>();

CrmContact newContact = new CrmContact();
newContact.FirstName = "John";
newContact.LastName = "Smith";

crmContactController.Create(newContact);

 

In the code above, an instance of the CrmControllerFactory class and a CrmEntityController is created as explained earlier. A CrmContact object is created and the properties are given values, before the Create method of the CrmEntityController is called.

Last edited Mar 13, 2012 at 10:16 AM by karolikl, version 4

Comments

No comments yet.