Presentation is loading. Please wait.

Presentation is loading. Please wait.

SharePoint data access and LINQ to SharePoint

Similar presentations


Presentation on theme: "SharePoint data access and LINQ to SharePoint"— Presentation transcript:

1 SharePoint data access and LINQ to SharePoint
Welcome SharePoint data access and LINQ to SharePoint Blog: Twitter: @PaulBeck1 Monday, April 04, 2011 from 6:00 PM - 8:00 PM – Johannesburg South Africa

2 Overview of the Evening
29/11/2018 Overview of the Evening 11/29/2018 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
Database Tables SP security and permissions Transactional Workflow Performance (trans volumes) Versioning Distinct queries and aggregations Office integration Greater flexibility Native / Easy setup Easy for .NET developers SP generates UI List is similar to table; Referential integrity; Performance;

4 Overview of SP2010 Data Access
11/29/2018 2:55 AM Overview of SP2010 Data Access Web Services Client-side REST APIs Strongly-typed Silverlight .NET ECMAScript Client OM Weakly-typed Data Platform Farm Site List Data External Lists Server-side Server OM Weakly-typed CAML LINQ to SharePoint Strongly-typed New in SP2010 Adapted from Todd Bleeker © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

5 context.ExecuteQuery();
29/11/2018 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) Client OM subdivision of Server OM Request to Client.svc is httpWebRequest or XmlWebRequest depending on client OM used. JSON Server OM

6 SP2010 Data Access REST API Web Service Syntax:
29/11/2018 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 Representational State Transfer (REST) Simple and integrated developer experience for list based Data Applications Server OM – API inefficient, patterns to displose objects, not strongly tped

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/SPMetal CAML
LINQ to SharePoint = SPLINQ = SPMetal Proxy LINQ to SharePoint/SPMetal Server OM CAML List SharePoint List data language-integrated query - extends C# and with native language syntax for queries and provides class libraries. 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 29/11/2018 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: /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 C# or VB.NET

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 Implement ICustomMapping.Resolve(..) Use the developer dashboard

15 Demonstration SPMetal.exe with parameters Generated code Demo1.1 To di

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

17 References & Thanks Paul Schaeflein Todd C. Bleeker Serge Luca
Mostafa Elzoghbi


Download ppt "SharePoint data access and LINQ to SharePoint"

Similar presentations


Ads by Google