Hands on LINQ to SharePoint Welcome Hands on LINQ to SharePoint Blog: http://blog.sharepointsite.co.uk Twitter: @PaulBeck1 Email: paul.beck@sharepointsite.co.uk Saturday, May 14, 2011 from 08:45 PM - 13:00 PM – Cobham South West London
Final Product Download the code What we are building http://blog.sharepointsite.co.uk/2011/05/sharepoint-retreat-south- west-london.html What we are building
Final Product 2 related lists Orders and Customers
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 History of LINQ language-integrated query - extends C# and with native language syntax for queries and provides class libraries. LINQ syntax, lambda & strongly-typed
16/06/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> /parameters:<file> Use parameters file, otherwise a class will be generated for each visible list, only show id and version from the hidden fields More flexible CKSDev for generating the LINQ to SharePoint proxy C# or VB.NET
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
16/06/2018 Selecting & Update Similar to T-SQL Lamda expressions
Insert
Delete
Display CAML Generated Code
Custom Site Columns The business entity class has to implement the ICustomMapping interface
Thank-you Blog: http://blog.sharepointsite.co.uk Twitter: @PaulBeck1 Email: paul.beck@sharepointsite.co.uk Reference & Thanks: Paul Schaeflein Todd C. Bleeker Serge Luca Mostafa Elzoghbi Ted Pattison