Ado vnext
Download
1 / 26

ADO vNext - PowerPoint PPT Presentation


  • 143 Views
  • Uploaded on

ADO vNext. LINQ LINQ to SQL Entity Framework. Freek Leemhuis freek.leemhuis@logica.com. Microsoft en ORM – de historie. Microsoft en ORM – de historie. WinFS. Defining LINQ and LINQ to SQL. Bestaat uit taal uitbreidingen in C# 3.0 en VB 9.0

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'ADO vNext' - casta


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Ado vnext

ADO vNext

LINQ

LINQ to SQL

Entity Framework

FreekLeemhuisfreek.leemhuis@logica.com


Microsoft en orm de historie

Microsoft en ORM – de historie

Microsoft en ORM – de historie

WinFS


Defining linq and linq to sql
Defining LINQ and LINQ to SQL

  • Bestaat uit taal uitbreidingen in C# 3.0 en VB 9.0

  • Uniforme manier om queries uit te voeren op objecten

LINQ

LINQ to SQL

  • Een framework (OR mapper) voor het mappen van data classes op SQL Server tables, views en stored procedures.


Linq parts
LINQ parts

.Net APIs

Providers

Interne query engine

LINQ to Datasets

LINQ to SQL

LINQ to XML

LINQ to Entities

LINQ to Objects

IEnumerable

IQueryable

C# 3.0

VB 9.0

Others

LINQ


Taaluitbreidingen
Taaluitbreidingen

  • Extension methods

  • Partial Methods

  • Lambda expressions

  • Anonymous types

  • Object initializers

  • Local variable inference

  • Linq keywords and operators


Ado vnext
Demo

  • Extention methods

  • Local variable inference

  • Anonymous types

Demo


De basis van linq
De basis van LINQ

  • LINQ queries gaan over elementen uit sequences

  • Een sequence is een object dat de IEnumerable<T> interface implementeert

    Bijvoorbeeld:

    String[] namen = {“Maarten”, “Ralph”, “Freek”};

    Selectie = namen.Where(n=>n.Contains(“a”)) .Orderby(n=>n) .Select(n=>n.ToUpper());





Query voorbeelden
Query voorbeelden

Query composition

var filtered = names .Where (n => n.Contains ("a"));

var sorted = filtered.OrderBy (n => n);

var query = sorted.Select (n => n.ToUpper( ));




Object relational impedance mismatch
Object Relational Impedance Mismatch

Objects != Data

Relationele Data

Objecten



Data access met ado net
Data Access met ADO.Net

Data Access met klassiekADO.Net

Queries in

quotes

SqlConnection c = new SqlConnection(…);

c.Open();

SqlCommandcmd = new SqlCommand(

@"SELECT c.Name, c.Phone

FROM Customers c

WHERE c.City = @p0");

cmd.Parameters.AddWithValue("@p0", "London“);

DataReaderdr = c.Execute(cmd);

while (dr.Read()) {

string name = dr.GetString(0);

string phone = dr.GetString(1);

DateTime date = dr.GetDateTime(2);

}

dr.Close();

Loosely bound

arguments

Loosely typed

result sets

No compile

time checks


Data access met linq to sql
Data Access met LINQ to SQL

Classes

describe data

public class Customer { … }

public class Northwind: DataContext

{

public Table<Customer> Customers;

}

Tables are

like collections

Strongly typed

connection

Northwind db = new Northwind(…);

var contacts =

from c in db.Customers

where c.City == "London"

select new { c.Name, c.Phone };

Integrated

query syntax

Strongly typed

results


Linq to sql mapping db to objects
Linq to SQL : Mapping DB to Objects

DataContext

Database

Table

View

Column

Relationship

Class + Collection

Class + Collection

Property

Nested Collection

Method

Stored Procedure


Linq to sql architectuur

LINQ to SQLDataContext

LINQ to SQL Architectuur

from c in Context.Customers

Where c.LastName.StartsWith(“Niks”) select new { c.Name, c.FirstName};

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

Services:- Change tracking- Concurrency control- Object identity

select Name, FirstNamefrom customerswhere Lastname like ‘Niks%'

Dynamische SQLof Stored Procedure

Applicatie

SQL Server


Linq to sql
LINQ to SQL

Demo

Title of Presentation


Ado vnext

Het ADO.Net Entity Framework

Conceptual

Mapping

Logical

CSDL

MSL

SSDL

Object Model

Relational Data

Table

Entity

Table

Entity

Table

Entity

Table

Entity

Table


Entity relationship model
Entity Relationship Model

Dr. Peter Chen, 1970


Entity framework architecture
Entity Framework Architecture

Object Services

LINQ to Entities

Object Query

Entity SQL

Entity SQL

Entity Client

Entity Framework Layers

Conceptual

CSDL

Mapping

MSL

Logical

SSDL



Resources
Resources

Starten met Linq

http://msdn2.microsoft.com/en-us/library/bb308961.aspx

http://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.aspx

Linqninjas

http://blogs.msdn.com/mattwar/default.aspx

http://weblogs.asp.net/fbouma

http://codebetter.com/blogs/ian_cooper/

http://mtaulty.com

LINQPad

http://www.linqpad.net/