SlideShare una empresa de Scribd logo
1 de 19
LinqToSharePoint
SandBoxed Solution



Shakir Majeed Khan
http://sharepointtechies.wordpress.com/
MySelf
http://junooni.wordpress.com/
shakir.majeed@gmail.com
www.facebook.com/shakir.majeed

      User Group Leader of
      SharePoint Techies,
      Working independently on
      SharePoint technologies.
      Trainer for Microsoft Office
      SharePoint Server
      2007 and Window
      SharePoint Services 3.0 at
      AUC Technologies.
Agenda
 session is divided into two
   LinqtoSharePoint
   SandBoxed Solution
 Questions
What’s wrong with this

                                                   Queries in
 SqlConnection c = new SqlConnection(…);            quotes
 c.Open();
 SqlCommand cmd = new SqlCommand(
   @"SELECT c.Name, c.Phone                      Loosely bound
      FROM Customers c                             arguments
      WHERE c.City = @p0");
 cmd.Parameters.AddWithValue("@p0", "London“);
 DataReader dr = c.Execute(cmd);                  Loosely typed
 while (dr.Read()) {                               result sets
    string name = dr.GetString(0);
    string phone = dr.GetString(1);
    DateTime date = dr.GetDateTime(2);           No compile time
 }                                                   checks
 dr.Close();
What’s wrong with this
LINQ (pronounced Link):
Language INtegrated Query
Language Integrated Query
Simplified, object-oriented way to query
Bridges OOP and relational data
Compile-time checked queries
Provides IntelliSense inside Visual Studio
Unified syntax for querying any data source
Linq to SQL

                                          Classes
 public class Customer { … }            describe data

 public class Northwind : DataContext
                                        Tables are like
 {                                        collections
   public Table<Customer> Customers;
   …
 }                                      Strongly typed
                                         connections
 Northwind db = new Northwind(…);
 var contacts =                          Integrated
   from c in db.Customers               query syntax
   where c.City == "London"
   select new { c.Name, c.Phone };
                                        Strongly typed
                                            results
CAML(Collaborative Application
MarkUp Language)
SPWeb web;
SPQueryquery = newSPQuery();                Queries in
                                             quotes
query.Query= String.Format(“<Where>
<And> <Eq>
<FieldRef Name='LastName' />
<Value Type='Text'>Shakir</Value>
</Eq> <Geq>
<FieldRef Name='Age' />                  Loosely bound
<Value Type='Number'>16</Value>            arguments
</Geq> </And>
</Where>”)                               No compile time
SPListItemCollectionl Coll=                  checks
web.Lists[“Employee”].GetItems(query);
Demo
C# Enhancments for LINQ
 IEnumerable<T>, IQueryable<T>
 Automatic Properties
 Object and Collection Initializers
 Lambda Expressions
 Query Syntax
 Anonymous Types
IEnumerable<T>, IQueryable<T>


   Contained in System.Collections.Generic
   Implemented by the query provider
   Supports a simple iteration or a query against
   that type
   This is what allows LINQ to query
Automatic Properties
  Allows short-hand property declarations
  Compiler emits getters and setters
  Used in LINQ to surface properties

public class Contact {
  public string FirstName { get; set; }
  public string LastName { get; set; }
}
Object and Collection Initializers
//Traditional approach
Contact c= new Contact();
c.FirstName = “shakir";
c.LastName = “majeed ";

//Object Initializer
Contact c= new Contact{ FirstName=“shakir", LastName=“Majeed          "
};

//Collection Initializer
List<Contact> contacts =    new List<Contact>{
 Contact c= new Contact{    FirstName=“shakir", LastName=“majeed"},
 Contact c= new Contact{    FirstName=“aamir", LastName=“majeed" },
 Contact c= new Contact{    FirstName=“zakir", LastName=“majeed" },
};
Lambda Expressions
    Compact way to write anonymous functions



// passing parameter using an anonymous delegate
IEnumerable<Contact> results =
  contacts.Where( delegate(Contact c) {return c.FirstName==“shakir”;} );


// equivalent code using a lambda expression
IEnumerable<Contact> results =
  contacts.Where( c => FirstName=="shakir" );
Query Syntax
   Offers a readable alternative to Method syntax



IEnumerable<Contact> results =
  contacts.Where( c=> FirstName=="shakir");

IEnumerable<Contact> results =
  from c in contacts
  where c.FirstName.Equals("shakir");
Anonymous Types
  Allows developers to use variables without
  declaring the type.
  Still strongly typed, but inferred



var results =
  from c in contacts
  where c.FirstName.Equals("Mike");
Demo
Thank You
Facebook: http://www.facebook.com/shakir.majeed
Blog: http://junooni.wordpress.com/
Email: shakir.majeed@gmail.com

Más contenido relacionado

La actualidad más candente

Realm Mobile Database - An Introduction
Realm Mobile Database - An IntroductionRealm Mobile Database - An Introduction
Realm Mobile Database - An IntroductionKnoldus Inc.
 
iOS Keychain by 흰, 민디
iOS Keychain by 흰, 민디iOS Keychain by 흰, 민디
iOS Keychain by 흰, 민디MINJICHO20
 
Elk devops
Elk devopsElk devops
Elk devopsIdeato
 
Simple.Data intro slides
Simple.Data intro slidesSimple.Data intro slides
Simple.Data intro slidesMark Rendle
 
Durable functions 2.0 (2019-10-10)
Durable functions 2.0 (2019-10-10)Durable functions 2.0 (2019-10-10)
Durable functions 2.0 (2019-10-10)Paco de la Cruz
 
Azure Durable Functions (2019-04-27)
Azure Durable Functions (2019-04-27)Azure Durable Functions (2019-04-27)
Azure Durable Functions (2019-04-27)Paco de la Cruz
 
MongoDB.local Berlin: App development in a Serverless World
MongoDB.local Berlin: App development in a Serverless WorldMongoDB.local Berlin: App development in a Serverless World
MongoDB.local Berlin: App development in a Serverless WorldMongoDB
 
MongoDB.local Berlin: Building a GraphQL API with MongoDB, Prisma and Typescript
MongoDB.local Berlin: Building a GraphQL API with MongoDB, Prisma and TypescriptMongoDB.local Berlin: Building a GraphQL API with MongoDB, Prisma and Typescript
MongoDB.local Berlin: Building a GraphQL API with MongoDB, Prisma and TypescriptMongoDB
 
Jupyter Notebooks for machine learning on Kubernetes & OpenShift | DevNation ...
Jupyter Notebooks for machine learning on Kubernetes & OpenShift | DevNation ...Jupyter Notebooks for machine learning on Kubernetes & OpenShift | DevNation ...
Jupyter Notebooks for machine learning on Kubernetes & OpenShift | DevNation ...Red Hat Developers
 
Asp.net server control
Asp.net  server controlAsp.net  server control
Asp.net server controlSireesh K
 
Durable functions
Durable functionsDurable functions
Durable functions명신 김
 
Data Binding and Data Grid View Classes
Data Binding and Data Grid View ClassesData Binding and Data Grid View Classes
Data Binding and Data Grid View ClassesArvind Krishnaa
 
BaasBox - Your mobile backend made easy
BaasBox - Your mobile backend made easyBaasBox - Your mobile backend made easy
BaasBox - Your mobile backend made easyCommit University
 
Azure Durable Functions (2019-03-30)
Azure Durable Functions (2019-03-30) Azure Durable Functions (2019-03-30)
Azure Durable Functions (2019-03-30) Paco de la Cruz
 
Chapter 27 Networking - Deitel & Deitel
Chapter 27 Networking - Deitel & DeitelChapter 27 Networking - Deitel & Deitel
Chapter 27 Networking - Deitel & DeitelCSDeptSriKaliswariCo
 

La actualidad más candente (20)

Realm Mobile Database - An Introduction
Realm Mobile Database - An IntroductionRealm Mobile Database - An Introduction
Realm Mobile Database - An Introduction
 
2310 b 12
2310 b 122310 b 12
2310 b 12
 
iOS Keychain by 흰, 민디
iOS Keychain by 흰, 민디iOS Keychain by 흰, 민디
iOS Keychain by 흰, 민디
 
Fetch data from form
Fetch data from formFetch data from form
Fetch data from form
 
Elk devops
Elk devopsElk devops
Elk devops
 
Simple.Data intro slides
Simple.Data intro slidesSimple.Data intro slides
Simple.Data intro slides
 
Durable functions 2.0 (2019-10-10)
Durable functions 2.0 (2019-10-10)Durable functions 2.0 (2019-10-10)
Durable functions 2.0 (2019-10-10)
 
Ado object
Ado objectAdo object
Ado object
 
Azure Durable Functions (2019-04-27)
Azure Durable Functions (2019-04-27)Azure Durable Functions (2019-04-27)
Azure Durable Functions (2019-04-27)
 
Parse Advanced
Parse AdvancedParse Advanced
Parse Advanced
 
MongoDB.local Berlin: App development in a Serverless World
MongoDB.local Berlin: App development in a Serverless WorldMongoDB.local Berlin: App development in a Serverless World
MongoDB.local Berlin: App development in a Serverless World
 
MongoDB.local Berlin: Building a GraphQL API with MongoDB, Prisma and Typescript
MongoDB.local Berlin: Building a GraphQL API with MongoDB, Prisma and TypescriptMongoDB.local Berlin: Building a GraphQL API with MongoDB, Prisma and Typescript
MongoDB.local Berlin: Building a GraphQL API with MongoDB, Prisma and Typescript
 
Jupyter Notebooks for machine learning on Kubernetes & OpenShift | DevNation ...
Jupyter Notebooks for machine learning on Kubernetes & OpenShift | DevNation ...Jupyter Notebooks for machine learning on Kubernetes & OpenShift | DevNation ...
Jupyter Notebooks for machine learning on Kubernetes & OpenShift | DevNation ...
 
Asp.net server control
Asp.net  server controlAsp.net  server control
Asp.net server control
 
Durable functions
Durable functionsDurable functions
Durable functions
 
Data Binding and Data Grid View Classes
Data Binding and Data Grid View ClassesData Binding and Data Grid View Classes
Data Binding and Data Grid View Classes
 
BaasBox - Your mobile backend made easy
BaasBox - Your mobile backend made easyBaasBox - Your mobile backend made easy
BaasBox - Your mobile backend made easy
 
Azure Durable Functions (2019-03-30)
Azure Durable Functions (2019-03-30) Azure Durable Functions (2019-03-30)
Azure Durable Functions (2019-03-30)
 
Android httpclient php_mysql
Android httpclient php_mysqlAndroid httpclient php_mysql
Android httpclient php_mysql
 
Chapter 27 Networking - Deitel & Deitel
Chapter 27 Networking - Deitel & DeitelChapter 27 Networking - Deitel & Deitel
Chapter 27 Networking - Deitel & Deitel
 

Destacado

GWT 2014: Smart City Conference - 07 Il ruolo delle tecnologie Geospaziali ne...
GWT 2014: Smart City Conference - 07 Il ruolo delle tecnologie Geospaziali ne...GWT 2014: Smart City Conference - 07 Il ruolo delle tecnologie Geospaziali ne...
GWT 2014: Smart City Conference - 07 Il ruolo delle tecnologie Geospaziali ne...Planetek Italia Srl
 
Sharepoint developement tools(webparts+worflows) EBizSoft
Sharepoint developement tools(webparts+worflows) EBizSoftSharepoint developement tools(webparts+worflows) EBizSoft
Sharepoint developement tools(webparts+worflows) EBizSoftShakir Majeed Khan
 
SharePoint 2010 and Changing Business Needs-MAJU 2011
SharePoint 2010 and Changing Business Needs-MAJU 2011SharePoint 2010 and Changing Business Needs-MAJU 2011
SharePoint 2010 and Changing Business Needs-MAJU 2011Shakir Majeed Khan
 
Workshop - Verso il Piano Regolatore di Ascoli Piceno - 02 - V. Barbieri
Workshop - Verso il Piano Regolatore di Ascoli Piceno - 02 - V. BarbieriWorkshop - Verso il Piano Regolatore di Ascoli Piceno - 02 - V. Barbieri
Workshop - Verso il Piano Regolatore di Ascoli Piceno - 02 - V. BarbieriPlanetek Italia Srl
 
UX@Vitra - Experience Continuum
UX@Vitra - Experience ContinuumUX@Vitra - Experience Continuum
UX@Vitra - Experience ContinuumKatrien De Graeve
 
Stug -Sir Syed University On Location-Live Event
Stug -Sir Syed University On Location-Live EventStug -Sir Syed University On Location-Live Event
Stug -Sir Syed University On Location-Live EventShakir Majeed Khan
 

Destacado (8)

GWT 2014: Smart City Conference - 07 Il ruolo delle tecnologie Geospaziali ne...
GWT 2014: Smart City Conference - 07 Il ruolo delle tecnologie Geospaziali ne...GWT 2014: Smart City Conference - 07 Il ruolo delle tecnologie Geospaziali ne...
GWT 2014: Smart City Conference - 07 Il ruolo delle tecnologie Geospaziali ne...
 
AUC Tech-SP 2010
AUC Tech-SP 2010AUC Tech-SP 2010
AUC Tech-SP 2010
 
Sharepoint developement tools(webparts+worflows) EBizSoft
Sharepoint developement tools(webparts+worflows) EBizSoftSharepoint developement tools(webparts+worflows) EBizSoft
Sharepoint developement tools(webparts+worflows) EBizSoft
 
SharePoint 2010 and Changing Business Needs-MAJU 2011
SharePoint 2010 and Changing Business Needs-MAJU 2011SharePoint 2010 and Changing Business Needs-MAJU 2011
SharePoint 2010 and Changing Business Needs-MAJU 2011
 
Sharepoint Online
Sharepoint OnlineSharepoint Online
Sharepoint Online
 
Workshop - Verso il Piano Regolatore di Ascoli Piceno - 02 - V. Barbieri
Workshop - Verso il Piano Regolatore di Ascoli Piceno - 02 - V. BarbieriWorkshop - Verso il Piano Regolatore di Ascoli Piceno - 02 - V. Barbieri
Workshop - Verso il Piano Regolatore di Ascoli Piceno - 02 - V. Barbieri
 
UX@Vitra - Experience Continuum
UX@Vitra - Experience ContinuumUX@Vitra - Experience Continuum
UX@Vitra - Experience Continuum
 
Stug -Sir Syed University On Location-Live Event
Stug -Sir Syed University On Location-Live EventStug -Sir Syed University On Location-Live Event
Stug -Sir Syed University On Location-Live Event
 

Similar a Share pointtechies linqtosp-andsbs

Ralf Laemmel - Not quite a sales pitch for C# 3.0 and .NET's LINQ - 2008-03-05
Ralf Laemmel - Not quite a sales pitch for C# 3.0 and .NET's LINQ - 2008-03-05Ralf Laemmel - Not quite a sales pitch for C# 3.0 and .NET's LINQ - 2008-03-05
Ralf Laemmel - Not quite a sales pitch for C# 3.0 and .NET's LINQ - 2008-03-05CHOOSE
 
Visual studio 2008
Visual studio 2008Visual studio 2008
Visual studio 2008Luis Enrique
 
Typed? Dynamic? Both! Cross-platform DSLs in C#
Typed? Dynamic? Both! Cross-platform DSLs in C#Typed? Dynamic? Both! Cross-platform DSLs in C#
Typed? Dynamic? Both! Cross-platform DSLs in C#Vagif Abilov
 
Linq E Ef 1207668728621762 9
Linq E Ef 1207668728621762 9Linq E Ef 1207668728621762 9
Linq E Ef 1207668728621762 9google
 
Linq 090701233237 Phpapp01
Linq 090701233237 Phpapp01Linq 090701233237 Phpapp01
Linq 090701233237 Phpapp01google
 
.NET Portfolio
.NET Portfolio.NET Portfolio
.NET Portfoliomwillmer
 
Database connectivity to sql server asp.net
Database connectivity to sql server asp.netDatabase connectivity to sql server asp.net
Database connectivity to sql server asp.netHemant Sankhla
 
GraphQL - when REST API is not enough - lessons learned
GraphQL - when REST API is not enough - lessons learnedGraphQL - when REST API is not enough - lessons learned
GraphQL - when REST API is not enough - lessons learnedMarcinStachniuk
 

Similar a Share pointtechies linqtosp-andsbs (20)

Introduction to Linq
Introduction to LinqIntroduction to Linq
Introduction to Linq
 
Understanding linq
Understanding linqUnderstanding linq
Understanding linq
 
Ralf Laemmel - Not quite a sales pitch for C# 3.0 and .NET's LINQ - 2008-03-05
Ralf Laemmel - Not quite a sales pitch for C# 3.0 and .NET's LINQ - 2008-03-05Ralf Laemmel - Not quite a sales pitch for C# 3.0 and .NET's LINQ - 2008-03-05
Ralf Laemmel - Not quite a sales pitch for C# 3.0 and .NET's LINQ - 2008-03-05
 
Visual studio 2008
Visual studio 2008Visual studio 2008
Visual studio 2008
 
LINQ
LINQLINQ
LINQ
 
Typed? Dynamic? Both! Cross-platform DSLs in C#
Typed? Dynamic? Both! Cross-platform DSLs in C#Typed? Dynamic? Both! Cross-platform DSLs in C#
Typed? Dynamic? Both! Cross-platform DSLs in C#
 
Mvc acchitecture
Mvc acchitectureMvc acchitecture
Mvc acchitecture
 
Linq E Ef 1207668728621762 9
Linq E Ef 1207668728621762 9Linq E Ef 1207668728621762 9
Linq E Ef 1207668728621762 9
 
Linq intro
Linq introLinq intro
Linq intro
 
PostThis
PostThisPostThis
PostThis
 
B_110500002
B_110500002B_110500002
B_110500002
 
Linq
LinqLinq
Linq
 
Linq 090701233237 Phpapp01
Linq 090701233237 Phpapp01Linq 090701233237 Phpapp01
Linq 090701233237 Phpapp01
 
Ado.Net
Ado.NetAdo.Net
Ado.Net
 
Greg Demo Slides
Greg Demo SlidesGreg Demo Slides
Greg Demo Slides
 
.NET Portfolio
.NET Portfolio.NET Portfolio
.NET Portfolio
 
Lambdas puzzler - Peter Lawrey
Lambdas puzzler - Peter LawreyLambdas puzzler - Peter Lawrey
Lambdas puzzler - Peter Lawrey
 
Linq
LinqLinq
Linq
 
Database connectivity to sql server asp.net
Database connectivity to sql server asp.netDatabase connectivity to sql server asp.net
Database connectivity to sql server asp.net
 
GraphQL - when REST API is not enough - lessons learned
GraphQL - when REST API is not enough - lessons learnedGraphQL - when REST API is not enough - lessons learned
GraphQL - when REST API is not enough - lessons learned
 

Más de Shakir Majeed Khan

STUG-Client Object Model SharePoint 2010
STUG-Client Object Model SharePoint 2010STUG-Client Object Model SharePoint 2010
STUG-Client Object Model SharePoint 2010Shakir Majeed Khan
 
SPS- Share Point 2010 and Windows Azure
SPS- Share Point 2010 and Windows AzureSPS- Share Point 2010 and Windows Azure
SPS- Share Point 2010 and Windows AzureShakir Majeed Khan
 
SharePoint 2010- Changing business needs
SharePoint 2010- Changing business needsSharePoint 2010- Changing business needs
SharePoint 2010- Changing business needsShakir Majeed Khan
 
STUG- SharePoint 2010 for ASP.net Devs
STUG- SharePoint 2010 for ASP.net DevsSTUG- SharePoint 2010 for ASP.net Devs
STUG- SharePoint 2010 for ASP.net DevsShakir Majeed Khan
 
SharePoint 2010 and its development tools
SharePoint 2010 and its development toolsSharePoint 2010 and its development tools
SharePoint 2010 and its development toolsShakir Majeed Khan
 
Microsoft SharePoint Server 2010-STUG- DCS-KU 9 feb live and on location
Microsoft SharePoint Server 2010-STUG- DCS-KU 9 feb live and on locationMicrosoft SharePoint Server 2010-STUG- DCS-KU 9 feb live and on location
Microsoft SharePoint Server 2010-STUG- DCS-KU 9 feb live and on locationShakir Majeed Khan
 
Stug-paf kiet 28 january live and on location-Enterprise Content Management
Stug-paf kiet 28 january live and on location-Enterprise Content Management Stug-paf kiet 28 january live and on location-Enterprise Content Management
Stug-paf kiet 28 january live and on location-Enterprise Content Management Shakir Majeed Khan
 
Sharepoint introanddevelopementtools
Sharepoint introanddevelopementtoolsSharepoint introanddevelopementtools
Sharepoint introanddevelopementtoolsShakir Majeed Khan
 

Más de Shakir Majeed Khan (10)

STUG-Sand boxed Solution
STUG-Sand boxed SolutionSTUG-Sand boxed Solution
STUG-Sand boxed Solution
 
STUG-Client Object Model SharePoint 2010
STUG-Client Object Model SharePoint 2010STUG-Client Object Model SharePoint 2010
STUG-Client Object Model SharePoint 2010
 
SPS- Share Point 2010 and Windows Azure
SPS- Share Point 2010 and Windows AzureSPS- Share Point 2010 and Windows Azure
SPS- Share Point 2010 and Windows Azure
 
SharePoint 2010- Changing business needs
SharePoint 2010- Changing business needsSharePoint 2010- Changing business needs
SharePoint 2010- Changing business needs
 
STUG- SharePoint 2010 for ASP.net Devs
STUG- SharePoint 2010 for ASP.net DevsSTUG- SharePoint 2010 for ASP.net Devs
STUG- SharePoint 2010 for ASP.net Devs
 
FCPakistan: a case study
FCPakistan: a case studyFCPakistan: a case study
FCPakistan: a case study
 
SharePoint 2010 and its development tools
SharePoint 2010 and its development toolsSharePoint 2010 and its development tools
SharePoint 2010 and its development tools
 
Microsoft SharePoint Server 2010-STUG- DCS-KU 9 feb live and on location
Microsoft SharePoint Server 2010-STUG- DCS-KU 9 feb live and on locationMicrosoft SharePoint Server 2010-STUG- DCS-KU 9 feb live and on location
Microsoft SharePoint Server 2010-STUG- DCS-KU 9 feb live and on location
 
Stug-paf kiet 28 january live and on location-Enterprise Content Management
Stug-paf kiet 28 january live and on location-Enterprise Content Management Stug-paf kiet 28 january live and on location-Enterprise Content Management
Stug-paf kiet 28 january live and on location-Enterprise Content Management
 
Sharepoint introanddevelopementtools
Sharepoint introanddevelopementtoolsSharepoint introanddevelopementtools
Sharepoint introanddevelopementtools
 

Último

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 

Último (20)

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 

Share pointtechies linqtosp-andsbs

  • 1. LinqToSharePoint SandBoxed Solution Shakir Majeed Khan http://sharepointtechies.wordpress.com/
  • 2. MySelf http://junooni.wordpress.com/ shakir.majeed@gmail.com www.facebook.com/shakir.majeed User Group Leader of SharePoint Techies, Working independently on SharePoint technologies. Trainer for Microsoft Office SharePoint Server 2007 and Window SharePoint Services 3.0 at AUC Technologies.
  • 3. Agenda session is divided into two LinqtoSharePoint SandBoxed Solution Questions
  • 4. What’s wrong with this Queries in SqlConnection c = new SqlConnection(…); quotes c.Open(); SqlCommand cmd = new SqlCommand( @"SELECT c.Name, c.Phone Loosely bound FROM Customers c arguments WHERE c.City = @p0"); cmd.Parameters.AddWithValue("@p0", "London“); DataReader dr = c.Execute(cmd); Loosely typed while (dr.Read()) { result sets string name = dr.GetString(0); string phone = dr.GetString(1); DateTime date = dr.GetDateTime(2); No compile time } checks dr.Close();
  • 7. Language Integrated Query Simplified, object-oriented way to query Bridges OOP and relational data Compile-time checked queries Provides IntelliSense inside Visual Studio Unified syntax for querying any data source
  • 8. Linq to SQL Classes public class Customer { … } describe data public class Northwind : DataContext Tables are like { collections public Table<Customer> Customers; … } Strongly typed connections Northwind db = new Northwind(…); var contacts = Integrated from c in db.Customers query syntax where c.City == "London" select new { c.Name, c.Phone }; Strongly typed results
  • 9. CAML(Collaborative Application MarkUp Language) SPWeb web; SPQueryquery = newSPQuery(); Queries in quotes query.Query= String.Format(“<Where> <And> <Eq> <FieldRef Name='LastName' /> <Value Type='Text'>Shakir</Value> </Eq> <Geq> <FieldRef Name='Age' /> Loosely bound <Value Type='Number'>16</Value> arguments </Geq> </And> </Where>”) No compile time SPListItemCollectionl Coll= checks web.Lists[“Employee”].GetItems(query);
  • 10. Demo
  • 11. C# Enhancments for LINQ IEnumerable<T>, IQueryable<T> Automatic Properties Object and Collection Initializers Lambda Expressions Query Syntax Anonymous Types
  • 12. IEnumerable<T>, IQueryable<T> Contained in System.Collections.Generic Implemented by the query provider Supports a simple iteration or a query against that type This is what allows LINQ to query
  • 13. Automatic Properties Allows short-hand property declarations Compiler emits getters and setters Used in LINQ to surface properties public class Contact { public string FirstName { get; set; } public string LastName { get; set; } }
  • 14. Object and Collection Initializers //Traditional approach Contact c= new Contact(); c.FirstName = “shakir"; c.LastName = “majeed "; //Object Initializer Contact c= new Contact{ FirstName=“shakir", LastName=“Majeed " }; //Collection Initializer List<Contact> contacts = new List<Contact>{ Contact c= new Contact{ FirstName=“shakir", LastName=“majeed"}, Contact c= new Contact{ FirstName=“aamir", LastName=“majeed" }, Contact c= new Contact{ FirstName=“zakir", LastName=“majeed" }, };
  • 15. Lambda Expressions Compact way to write anonymous functions // passing parameter using an anonymous delegate IEnumerable<Contact> results = contacts.Where( delegate(Contact c) {return c.FirstName==“shakir”;} ); // equivalent code using a lambda expression IEnumerable<Contact> results = contacts.Where( c => FirstName=="shakir" );
  • 16. Query Syntax Offers a readable alternative to Method syntax IEnumerable<Contact> results = contacts.Where( c=> FirstName=="shakir"); IEnumerable<Contact> results = from c in contacts where c.FirstName.Equals("shakir");
  • 17. Anonymous Types Allows developers to use variables without declaring the type. Still strongly typed, but inferred var results = from c in contacts where c.FirstName.Equals("Mike");
  • 18. Demo
  • 19. Thank You Facebook: http://www.facebook.com/shakir.majeed Blog: http://junooni.wordpress.com/ Email: shakir.majeed@gmail.com

Notas del editor

  1. This slide shows the language enhancements for C# that directly support LINQ. These enhancements make it possible to write compact LINQ queries in a single statement.
  2. Short hand properties with no member variables
  3. Again, short hand with no member variables
  4. var keyword