Linq to CRM (Microsoft Dynamics CRM 4.0)

This way, querying to CRM is so easy and understandable (http://linqtocrm.codeplex.com/).
 
Using this together with the crm toolkit (http://code.msdn.microsoft.com/E2DevTkt)
some casting must be done because linqtocrm does not work out of the box with the toolkit. It does however with the CRM SDK. Using anonymous classes, the SDK entities are casted to the toolkit entities like:
 
AddressValidator target = new AddressValidator(this.ServiceAdapter);
CrmQueryProvider p = new CrmQueryProvider(this.ServiceAdapter);
var accounts = from c in p.Linq<account>()
               select new Account()
               {
                   Id = c.accountid,
                   Address1Country = c.address1_country,
                   Address1Postalcode = c.address1_postalcode
               };
 
Now we have an array of Account (not account)!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: