Wednesday, June 15, 2011

SharePoint 2010 Data Technologies

If you are a SharePoint developer then for you the most important task is working with and manipulating data. SharePoint 2010 introduced many new Data Technologies that you can take advantage for manipulating Data. It all depends on you, what technology you want according to your requirement and comfort.

Lets discuss Data Technologies in brief. You can use
  • LINQ
  • Server side Object Model
  • Client Side Object Model
  • REST
LINQ:
LINQ is strongly typed entity based programming. In MOSS we used to write CAML as string and Pass it to object like SPQuery. SharePoint 2010 introduces LINQ to write query in strongly typed way and Intelligence and compile time checking. LINQ supports JOINS. LINQ is server side. The first step is to generate entity classes and properties of lists using SPMetal (shipped with SharePoint 2010).
Disadvantage of this is, changing of a list a may break up the whole application and may require to regenerate entity classess. LINQ put some overhead to your code.


Client Object Model:
In MOSS 2007 if you want to write a program on client side there is no choice other than Web Service. SharePoint 2010 introduced new feature Client object model. Using this developers can acees and manipualate data on client computers. This need not requires any deployment on server. Using CO Model we can access data directly from .net Application, Silverlight or from Javascript (ECMAScript). CO Model batches together all its commands and sends all of them together for processing. This will make better performance as less round trips to the server.
Disadvantage: This is not strongly Typed. 

Equivalent objects in Server and Client Object Models


Server Object Model Client Object Model ECMAScript
Microsoft.SharePoint.SPSite Microsoft.SharePoint.Client.Site SP.Site
Microsoft.SharePoint.SPWeb Microsoft.SharePoint.Client.Web SP.Web
Microsoft.SharePoint.SPList Microsoft.SharePoint.Client.List SP.List
Microsoft.SharePoint.SPListItem Microsoft.SharePoint.Client.ListItem SP.ListItem
  
REST: Representational State Tranfer
In simple words REST is URL based functionality. We can create, query and delete lists and items using standard HTTP protocol. For this ADO.net data services needs to be installed on Sharepoint Server. REST is implemented in _vti_bin.
e.g 
~siteurl/_vti_bin/ListData.svc
will return list of all lists in your site

~siteurl/_vti_bin/ListData.svc/Listname
will return List

~siteurl/_vti_bin/ListData.svc/Listname(ItemID)
will return list item

No comments:

Post a Comment

Popular Posts