Top Banner
The Microsoft Technical Roadshow 2007 Advances for Data in VS “Orcas” Mike Taulty Developer & Platform Group Microsoft Ltd [email protected] http://www.mtaulty.com
30

The Microsoft Technical Roadshow 2007 Advances for Data in VS “Orcas” Mike Taulty Developer & Platform Group Microsoft Ltd [email protected] .

Dec 21, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: The Microsoft Technical Roadshow 2007 Advances for Data in VS “Orcas” Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com .

The Microsoft

Technical Roadshow 2007

Advances for Data in VS “Orcas”

Mike TaultyDeveloper & Platform GroupMicrosoft [email protected] http://www.mtaulty.com

Page 2: The Microsoft Technical Roadshow 2007 Advances for Data in VS “Orcas” Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com .

Earlier that day....

ObjectObject

ObjectObject

Page 3: The Microsoft Technical Roadshow 2007 Advances for Data in VS “Orcas” Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com .

IEnumerable<T>?

ObjectObject

ObjectObject

from itemName in srcExprwhere predExprorderby (keyExpr (ascending | descending)?)*select selExpr...

where ObjectObject

ObjectObjectorderby

selectObjec

t

Page 4: The Microsoft Technical Roadshow 2007 Advances for Data in VS “Orcas” Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com .

IQueryable<T>?

ObjectObject

ObjectObject

from itemName in srcExprwhere predExprorderby (keyExpr (ascending | descending)?)*select selExpr...

where

whereorderby

whereorderby

select

ObjectObject

ObjectObject

Object

Page 5: The Microsoft Technical Roadshow 2007 Advances for Data in VS “Orcas” Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com .

IEnumerable vs IQueryable

Page 6: The Microsoft Technical Roadshow 2007 Advances for Data in VS “Orcas” Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com .

Agenda”Would you like LINQ with that?”

1 2

3

Page 7: The Microsoft Technical Roadshow 2007 Advances for Data in VS “Orcas” Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com .

LINQ Pattern from itemName in srcExpr join itemName in srcExpr on keyExpr equals keyExpr

(into itemName)?let itemName = selExprwhere predExprorderby (keyExpr (ascending | descending)?)*select selExprgroup selExpr by keyExpr into itemName query-body

LINQ over XML1

Page 8: The Microsoft Technical Roadshow 2007 Advances for Data in VS “Orcas” Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com .

System.Xml.XLinq

New XML API (more DOM than reader)Key classes: XElement, XAttribute

Page 9: The Microsoft Technical Roadshow 2007 Advances for Data in VS “Orcas” Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com .

LINQ over XML

Page 10: The Microsoft Technical Roadshow 2007 Advances for Data in VS “Orcas” Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com .

LINQ to SQL2

Page 11: The Microsoft Technical Roadshow 2007 Advances for Data in VS “Orcas” Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com .

System.Data.Dlinq – Data API

Page 12: The Microsoft Technical Roadshow 2007 Advances for Data in VS “Orcas” Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com .

DataContext, Table & Friends

Page 13: The Microsoft Technical Roadshow 2007 Advances for Data in VS “Orcas” Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com .

But what about?

IdentityRelationshipsInsert, Update, DeleteConstraintsGenerated columnsTransactions

Stored Procedures, Views, FunctionsDeferred LoadingInheritanceConcurrencyModifications without query

e.g. N-Tier updates

Page 14: The Microsoft Technical Roadshow 2007 Advances for Data in VS “Orcas” Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com .

More detail but no updates yet...

Page 15: The Microsoft Technical Roadshow 2007 Advances for Data in VS “Orcas” Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com .

Identity Management

SQL

My Process

Identity Management

Row ID = 58, Colour=Red

Query Id=58

UpdateId=58,

Colour=Blue

QueryId=58

ObjectId=58,

Colour = Red Original

ObjectId=58,

Colour = Blue

Current

Page 16: The Microsoft Technical Roadshow 2007 Advances for Data in VS “Orcas” Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com .

Change Tracking (1)

SQL

DataContext.SubmitChanges()

Compare & Generate SQL

My Process

Change TrackingObjectId=58,

Colour = Red Original

ObjectId=58,

Colour = Blue

Current

Page 17: The Microsoft Technical Roadshow 2007 Advances for Data in VS “Orcas” Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com .

Change Tracking (2)

SQL

My Process

Change Tracking

UpdateId=58,

Colour=Blue

ObjectId=58,

Colour = Red Original

ObjectId=58,

Colour = Blue

Current

Fire PropertyChanged

Notification!

Page 18: The Microsoft Technical Roadshow 2007 Advances for Data in VS “Orcas” Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com .

Change Tracking (3)

SQL

DataContext.SubmitChanges()

My Process

Change TrackingObjectId=58,

Colour = Blue

Current

Generate SQL from List of Changes

Page 19: The Microsoft Technical Roadshow 2007 Advances for Data in VS “Orcas” Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com .

Updates, Transactions...

Page 20: The Microsoft Technical Roadshow 2007 Advances for Data in VS “Orcas” Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com .

LINQ Pattern from itemName in srcExpr join itemName in srcExpr on keyExpr equals keyExpr

(into itemName)?let itemName = selExprwhere predExprorderby (keyExpr (ascending | descending)?)*select selExprgroup selExpr by keyExpr into itemName query-body

DataSet/DataTable

LINQ to DataSet3

Page 21: The Microsoft Technical Roadshow 2007 Advances for Data in VS “Orcas” Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com .

Linq to DataSet

Existing DataTable already has some query capabilities

LINQ syntax extends to DataSet to apply the same model for querying

Page 22: The Microsoft Technical Roadshow 2007 Advances for Data in VS “Orcas” Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com .

LINQ to DataSet

Page 23: The Microsoft Technical Roadshow 2007 Advances for Data in VS “Orcas” Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com .

Putting a few things together

Page 24: The Microsoft Technical Roadshow 2007 Advances for Data in VS “Orcas” Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com .

Awareness:ADO.NET Entity Framework

Page 25: The Microsoft Technical Roadshow 2007 Advances for Data in VS “Orcas” Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com .

Conceptual Models

Conceptual Design(Entities & Relationships)

Customer Order

SalesPerson

places

sells

Application(Entities & Relationships)

Page 26: The Microsoft Technical Roadshow 2007 Advances for Data in VS “Orcas” Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com .

Relational Models

Application(Entities & Relationships)

relational schema(normalised, tables, keys)

SP's

Views

Fn's

Mapping LogicConceptual<->Relational

Application(Entities & Relationships)

SP's

Views

Fn's

Mapping LogicConceptual<->Relational

Application(Entities & Relationships)

SP's

Views

Fn's

Mapping LogicConceptual<->Relational

Page 27: The Microsoft Technical Roadshow 2007 Advances for Data in VS “Orcas” Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com .

ADO.NETMapping Provider

Entity SQL

Object Services(Inheritance & Complex Types)

ADO.NETDatabase Provider(e.g. SqlProvider)

SQL

Application(Entities & Relationships)

LINQ Syntax

ConceptualSchema(XML)

Mapping

Schema(XML)

StoreSchema(XML)

ADO.NET Entity Framework

Page 28: The Microsoft Technical Roadshow 2007 Advances for Data in VS “Orcas” Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com .

Do Try This At Home But...

This Talk Was Brought To You By;

The LINQ May CTPThe ADO.NET V.Next August CTP

Concepts have not changedLater CTPs have slightly altered syntaxMy CTP lacked IntelliSense

In the later builds

Page 29: The Microsoft Technical Roadshow 2007 Advances for Data in VS “Orcas” Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com .

Summary

Powerful, intuitive LINQ patternOne "syntax" to learnRelational, hierarchical, object dataUnderpinned by new or existing API's

For Relational DataLINQ to SQL

– ORM over database schema

LINQ to Entities and the Entity Framework– ORM over conceptual model

Page 30: The Microsoft Technical Roadshow 2007 Advances for Data in VS “Orcas” Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com .

© 2007 Microsoft Ltd. 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.