Linq to SQL Chalk Talk Freek Leemhuis Rob Huibers Logica

Preview:

Citation preview

Linq to SQLChalk Talk

Freek LeemhuisRob HuibersLogica

LINQ• Bestaat uit taal uitbreidingen in C# 3.0 en VB 9.0 • Uitbreidbaar door LINQ providers voor externe

data formaten (bijvoorbeeld MS SQL Server).

LINQ to SQL• Een framework(OR mapper) voor het mappen

van data classes op SQL Server tables, views en stored procedures.

Taaluitbreidingen

• Linq keywords• Extension methods• Partial Methods• Lambda expressions• Anonymous types• Object initializers• Local variable inference

LINQ parts

Interne query engine

LINQ to Objects

.Net APIs

LINQ to Datasets

LINQ to XML

Providers

LINQ to SQL LINQ to Entities

IQueryableIEnumerable

Object Relational Mapping

Objecten

Objects != Data

Relationele Data

LINQ to SQL Architectuur

from c in Context.Customers Where c.LastName. StartsWith(“Niks”)

select new { c.Name,

c.FirstName};

from c in Context.Customers Where c.LastName. StartsWith(“Niks”)

select new { c.Name,

c.FirstName};

select Name, FirstNameselect Name, FirstNamefrom customersfrom customerswhere Lastname like where Lastname like ‘Niks%'‘Niks%'

Services:Services:- Change tracking- Change tracking- Concurrency control- Concurrency control- Object identity- Object identity

Services:Services:- Change tracking- Change tracking- Concurrency control- Concurrency control- Object identity- Object identity

SQL Server

Customer c = new Customer();Customer c = new Customer();Customer.LastName = “Bos”;Customer.LastName = “Bos”;Customers.InsertOnSumbit(c);Customers.InsertOnSumbit(c);Context.SubmitChanges();Context.SubmitChanges();

Dynamische SQLDynamische SQLof Stored Procedureof Stored Procedure

Het ADO.Net Entity FrameworkConceptual Mapping Logical

Object Model

Relational Data

Entity

Entity

Entity

Entity

Table

Table

Table

Table

CSDL MSL SSDL

Table

LINQ to SQL versus Entity Framework

Linq to SQL in N-tier Architectuur

ResourcesStarten met Linqhttp://msdn2.microsoft.com/en-us/library/bb308961.aspxhttp://www.asp.net/learn/linq-videos/http://weblogs.asp.net/scottgu/archive/tags/LINQ/ http://www.hookedonlinq.com/http://msdn2.microsoft.com/en-us/vcsharp/aa336746.aspxLinq ninjashttp://blogs.msdn.com/mattwar/default.aspxhttp://weblogs.asp.net/fboumahttp://codebetter.com/blogs/ian_cooper/http://mtaulty.comLINQPadhttp://www.linqpad.net/

Recommended