clicksor

Thursday, October 31, 2013

LINQ used in MS CRM 2011

 
 

LINQ Operator
 
 
 The Linq operators are as follows,
 
- Join
 
- From
 
- where
 
- Group by
 
- Order by
 
- last
 
- skip
 
- Aggregate


 
  For Query the data in many ways, one of help way is LINQ with this syntax we can query the data very easily, that means , we can retrieve the data or update or delete or save the changes of the data.
Microsoft Dynamics CRM 2011 , developers can use .NET Language- Integrated Query (LINQ) to write queries. They can use the OrganizationServiceContext class or a deriving class created by the CrmSvcUtil tool to write LINQ queries that access the Simple Object Access Protocol (SOAP) endpoint (Organization.svc). The OrganizationServiceContext class contains an underlying LINQ query provider that translates LINQ queries from Microsoft Visual C# or Microsoft Visual Basic .NET syntax into the query API used by Microsoft Dynamics CRM.
 
 
 
The LINQ query provider supports a subset of the LINQ operators. Not all conditions that can be expressed in LINQ are supported. The following table shows some limitations of the basic LINQ operators.
 
 
 
 
// An Example explains the update or delete using LINQ
 
Var q= from a in _oservice.Account where (a.state="AP") select a;
 
foreach( var a in q)
 
{
 

   a.state="Andhra Pradesh";

   _oservice.updateObject(a);

          or

  _oservice.deleteObject(a);


}

_oservice.saveChanges();

 
 

1 comment: