1 / 17

Welcome

Welcome. SharePoint data access and LINQ to SharePoint. Blog: http://blog.sharepointsite.co.uk Twitter: @PaulBeck1 Email : paul.beck@sharepointsite.co.uk. Monday, April 04, 2011 from 6:00 PM - 8:00 PM – Johannesburg South Africa. Overview of the Evening. SharePoint Lists

dayo
Download Presentation

Welcome

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Welcome SharePoint data access and LINQ to SharePoint Blog: http://blog.sharepointsite.co.uk Twitter: @PaulBeck1 Email: paul.beck@sharepointsite.co.uk Monday, April 04, 2011 from 6:00 PM - 8:00 PM – Johannesburg South Africa

  2. Overview of the Evening • SharePoint Lists • Overview of SharePoint Data Access • LINQ to SharePoint • How to use LINQ to SharePoint (CRUD) • Demonstration

  3. SharePoint Lists Comparison of SP2010 lists vs. DB tables

  4. Overview of SP2010 Data Access Web Services REST APIs Client-side Strongly-typed ClientOM Weakly-typed Data Platform Farm Site List Data External Lists Server-side ServerOM Weakly-typed LINQ to SharePoint Strongly-typed New in SP2010 Adapted from Todd Bleeker

  5. SP2010 Data Access Client Object Model • 3 options • Silverlight CLR • .NET CLR • JavaScript Client Application Using Client OM SharePoint 2010 XML context.ExecuteQuery(); ListData.svc (WCF) JSON Server OM

  6. SP2010 Data Access REST API Syntax: /_vti_bin/ListData.svc/{Entity}[({identifier})]/[{Property}] Example to get the tax spent for the 4th Order: /_vti_bin/ListData.svc/Orders(4)/TaxSpent Web Service *.asmx

  7. SP2010 Data Access Server Object Model • Managed code for COM • Flexible scope • List performance (CAML) • CAML to manipulate SP2010 list data • SPQuery(query within the site) • SPSiteDataQuery (cross site collection query) • U2U tool

  8. LINQ to SharePoint LINQ to SharePoint = SPLINQ = SPMetal • LINQ syntax, lambda & strongly-typed

  9. Decision Matrix for SP2010 Data Access Source: Todd Bleeker & Paul Schaeflein –SP data access decision matrix

  10. Overview of SP2010 Data Access Other Options • LINQ to SQL • Entity framework • BCS • WCF/Web Services • BLOB Storage • AZURE/the cloud • File systems • XML

  11. SPMetal.exe • SPMetal.exe is the tooling to generate the LINQ to SharePoint proxy code • Generates strongly typed classes • SPMetal.exe in 14\bin • Syntax: • spmetal /web:<url> /code:<file> • spmetal/web:<url> /code:<file> /parameters:<file> • spmetal /web:http://localhost /code:c:\ListData.cs/namespace:PaulBeck.SP2010.BOL • Use parameters file, otherwise a class will be generated for each visible list, only show id and version from the hidden fields • More flexible

  12. Issues with LINQ to SharePoint • “Inefficient” queries – Querying data, Joins .ToList() - Non CAML compliant queries need to work around using LINQ to Objects. • Add hidden fields, hide lists (parameters file) • Only supports SP2010 foundation fields • Attachments, managed metadata, custom site columns requires ICustomMapping. • SPMetal cannot query cross site collections • External Content Types are not supported

  13. Query across site collections • How many site collections? • Microsoft supports up to 200 GB content databases: performance decreases & disaster recovery becomes complex • Create several site collections (be prepared as LINQ to SharePoint doesn’t cross Site collections unless you use REST with LINQ to SharePoint)

  14. LINQ to SharePoint Best Practices • ObjectTrackingEnabled=false; • Use parameters to include hidden fields • Use projected fields, lookups are expensive • ImplementICustomMapping.Resolve(..) • Use the developer dashboard

  15. SPMetal.exe with parameters • Generated code Demonstration

  16. Thank-you Blog: http://blog.sharepointsite.co.uk Twitter: @PaulBeck1 Email: paul.beck@sharepointsite.co.uk

  17. References & Thanks • Paul Schaeflein • Todd C. Bleeker • Serge Luca • MostafaElzoghbi

More Related