Presentation is loading. Please wait.

Presentation is loading. Please wait.

MSDN Roadshow Rerun Welcome.

Similar presentations


Presentation on theme: "MSDN Roadshow Rerun Welcome."— Presentation transcript:

1 MSDN Roadshow Rerun Welcome

2 Agenda 09.30 –09.45:Welcome – What’s New in 2008 for .NET Developers?
09.45 – 11.00:ADO.NEXT – Entity Framework & Data Services 11.00 – 11.30:Break 11.30 – 12:45:ASP.NEXT – The ASP.NET 3.5 Extensions 12.45 – 13.30:Lunch 13.30 – 14.45:Building Rich Internet UI with Silverlight 2.0 14.45 – 15.00:Break 15.00 – 16.15:Getting the most from the Visual Studio Team Suite Toolbox 16.15 – 16.45:Q & A

3 ADO.NEXT Entity Framework & Data Services
Eric Nelson Developer & Platform Group Microsoft Ltd © 2007 Microsoft Corporation. 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.

4 Not forgetting SQL Server 2008 (Actually I am but bear with me...)
Relational Improved XML UDTs New Filestream Hierarchy ID Date & Time Spatial data Sparse columns and wide tables Filtered indexes Change tracking Table parameters to SP calls Resource governor SP control and monitoring Database compression Declarative management ... SQL Server Integration Services VSTA replaces VSA ADO.NET Performance Merge ... Reporting Services “IIS free” Tablix New designer BI Cube design Design alerts

5 ADO.NET Entity Framework
.NET 3.5 SP1 gave us... ADO.NET Data Services ADO.NET Entity Framework

6 Data Access over the years
Accessing data in 1990 ODBC, embedded SQL Accessing data in 2000 ADO, Stored Procedures Accessing data in 2005 ADO.NET, Datasets, DataReaders Accessing data in 2010 ORM baby!

7 Object Relational Mapping
What is it? Technique for working with relational tables as if they were objects in memory Intention is to hide away the complexity of the underlying tables and give a uniform way of working with data Why use it? Productivity Retain database independence Notes There are many ORMs for .NET developers already in existence. E.g. LLBLGen Pro Nhibernate EntitySpaces Objects vs Classes vs Entities

8 Entity Framework 2/27/2019 11:31 AM
© 2007 Microsoft Corporation. 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.

9 ADO.NET Entity Framework
What is it? Tools and services to create an Entity Data Model EDM gives ORM to SQL Server, Oracle, DB2 etc Tools and services for consuming an Entity Data Model Why use it? Productivity Complex mapping between entities and database tables Works great with ADO.NET Data Services Notes Strategic but just released...

10 Entity Data Model Application model Comprised of three layers:
Mapped to a persistence store Comprised of three layers: Conceptual (CSDL) Mapping (MSL) Storage (SSDL) Database agnostic Comprised of: Entities Associations Functions Conceptual Mapping Estimated Time: 6 minutes Talking Points: When we talk about the Entity Framework, we’re actually talking about two things: The Entity Data Model (EDM) The Entity Framework It’s important to delineate the two as separate, but complementing technologies The EDM is a set of layers that make up your application’s model, as well as it’s mapping to an underlying data store. Made up of three files: CSDL (Conceptual Schema Definition Language) MSL (Mapping Specification Language) SSDL (Storage Schema Definition Language) This separation of concerns allows great flexibility: Model your application the way you want regardless of the state/structure of its underlying data store Normalize your database as much as you need without worrying about affecting the interface of the application’s object model The EDM represents a re-useable application model that can be leveraged from within many applications/environments and persisted across numerous databases. The Entity Data Model is RDMS agnostic, and numerous database vendors are currently developing providers: Oracle, DB2, MySQL, PostgreSQL, VistaDB, SQLite, Sybase, Informix, etc. The Entity Data Model primarily of three main concepts: Entities, which represent your domain objects. Associations, which represent a relationship between two entities. Functions, which represent stored procedures or UDFs in your database that can be mapped to model-level functionality. Because there will be plenty of situations where you’ll need to use stored procedures, the Entity Data Model allows you to map functions in your model to a store procedure in your database. This is useful because you can leverage a stored procedure without having to write ADO.NET code to call it, you can simply call a function on your model. EDM functions are represented as methods on your ObjectContext class. Storage

11 demo { Creating the EDM } 2/27/2019 11:31 AM
© 2007 Microsoft Corporation. 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.

12 Consuming the Entity Data Model
Entity Client Entity SQL Object Services LINQ To Entities Estimated Time: 1 minute Talking Points: Now that we’ve seen the Entity Data Model, let’s see how to work with it using the Entity Framework. The Entity Framework is a set of services that allow you to consume an EDM from within your applications: Entity Client Entity SQL Object Services LINQ To Entities We’ll take a look at the 3 different flavors on consumption in detail, and discuss why and when you would use each one.

13 Entity Client Familiar ADO.NET object model: Text-based results
EntityCommand EntityConnection EntityDataReader EntityParameter EntityTransaction Text-based results Read-only Uses Entity SQL Estimated Time: 4 minutes Talking Points: The Entity Client is an Entity Framework “port” of the familiar object model of classes used in traditional ADO.NET programming, including: EntityCommand EntityConnection EntityConnectionStringBuilder EntityDataReader EntityParameter EntityTransaction Because of this fact it makes it a prime choice for developers migrating to the Entity Framework from ADO.NET. Just like traditional ADO.NET, your queries are returned as sequential text-based data that can iterated over using an EntityDataReader. This is great for performance, but lacks the rich object model that was created as part of your EDM. Entity Client gives you read-only access to your EDM. If data modification is required, you’ll have to use Object Services, which we’ll talk about in a bit. When using Entity Client, your queries are written using Entity SQL, which we’ll talk about in the next slide.

14 Object Services Queries materialized as Objects
ObjectContext ObjectQuery<T> Built on top of Entity Client Two query options: Entity SQL LINQ Runtime services: Unit of work Identity tracking Eager/explicit loading Estimated Time: 5 minutes Talking Points: While the Entity Client API is great and performant, it lacks the use of our created object model, as well as the ability to update data in our model. The Object Services API sits on top of Entity Client, and provides object materialization on top of our queries. This means that instead of getting text-based results, we get back a collection of CLR objects that we can easily work with. The two mains components of the Object Services taxonomy are: ObjectContext, and ObjectQuery<T> ObjectContext is equivalent to an EntityConnection, and is what manages our connection to the EDM as well as provides crucial services for working with our data. ObjectQuery is equivalent to an EntityCommand and represents a single query executed against our EDM, that is manifested back as strongly-typed objects. Object Services allows you to write queries using two flavors: Entity SQL LINQ To Entities The same Entity SQL queries you would write using Entity Client can be leveraged with Object Services, but with the added benefits you get with the higher abstraction level (i.e. object materialization). While Entity SQL is great for scenarios that require a dynamic query, or greater control over your query’s shape, you’re still working with a string that is error-prone. In addition to Entity SQL, Object Services allows you to write your queries against it in LINQ which provides you with strong-typing, error- checking, and a higher level of abstraction from Entity SQL. If you are already familiar with LINQ, then you don’t have to master Entity SQL in order to query an EDM, because LINQ To Entities will make the translation for you. In addition to object materialization, object services provides you with other benefits/services: Unit of work Your Object Context represents your unit of work, which aggregates all changes made to all entities attached/contained in it, so that when you want to push those changes back to the server, you can do so in a single batch. Identity tracking The ObjectContext keeps track of the entities you’ve queried for by key, so that if you later request the same entity (by key), using the same ObjectContext instance, it will return you the instance it already has instead of re-hitting the database. Eager/explicit loading The Entity Framework doesn’t pre-load any relationship properties for you. If you want to query an entity as well as some of it’s related entities, you’ll need to explicitly request that by performing a “span” using the Include method of the ObjectQuery<T> class. Alternatively you can call the Load method on your entity’s relationship property.

15 Entity Framework – Service Stack
Entity SQL LINQ To Entities Object Services Entity Client Estimated Time: 3 minutes Talking Points: This diagram helps to illustrate how each of the Entity Framework’s query options relate to each other. At the core of it all is the database-specific provider. This layer is what translates the query into the SQL flavor required for the underlying data source. Above that is the Entity Client API, which takes the Entity Framework query and passes in down to the database specific provider. If you want to use the Entity Client API directly, you see that you’re only query option is Entity SQL, and because it sits below Object Services, you don’t get any of its benefits. If you want to materialize your queries as objects, and get things like change tracking, identity mapping, relationship loading, etc. then you would use object services, that delegates its queries down to the Entity Client layer. When using Object Services you can leverage both Entity SQL and LINQ to make your queries. ADO.NET Provider

16 demo { Consuming an EDM} 2/27/2019 11:31 AM
© 2007 Microsoft Corporation. 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.

17 EF Providers in Progress
Vendor DB Support Microsoft SQL Server Oracle Sample, Generic Sample Devart Oracle, MySQL, Postgress Phoenix SQLite Sybase SQLAnywhere Npgsql PostgreSQL IBM DB2, Informix Dynamic Server MySQL AB MySQL OpenLink Many via OpenLink ODBC or JDBC DataDirect Oracle, Sybase, SQL Server, DB2 Firebird

18 LINQ to SQL vs LINQ to Entities 1/2
Database Support SQL Server Many Object Relational Mapping Capabilities Simple Complex Requires Attributed .NET Code No Yes Status Released Just Released 

19 Similar – but not quite 2/2
LINQ to SQL var products = from prod in db.Product where prod.Color == "Blue" select prod; LINQ to Entities In general – LINQ to Entities does more – but not always! Only migration that will ever happen is LINQ to SQL migration to LINQ to Entities

20 2/27/ :31 AM Data Services © 2007 Microsoft Corporation. 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.

21 ADO.NET Data Services What is it? Why use it?
HTTP access to an object model exposed as RESTful Web Services Data and/or methods Data returned using ATOM or JSON Read/Write Why use it? Easy to expose data over the internet/intranet accessible by any client

22 Creating Data Services
HTTP Hosting/HTTP Listener Data Services Runtime IQueryable/IEnumerable [+ IUpdatable] Data Access Layer Entity Framework Custom Relational database Other sources

23 demo { Data Services } 2/27/2019 11:31 AM
© 2007 Microsoft Corporation. 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.

24 Conclusion 1990 to 2007 - Tables 2008 – Objects
Data Access technology remained reasonably static Procedural, API access Surfaced the database schema 1990 to Tables LINQ – excellent addition to the .NET languages Entity Framework and the EDM – strategic investment Data Services – as easy as it gets? Productivity leap 2008 – Objects

25 Resources http://blogs.msdn.com/UKDevEvents The team
Post event resources for all Microsoft UK developer focused sessions The team Eric Nelson Mike Ormond Mike Taulty

26

27 Appendix

28 Acronyms EDM = Entity Data Model EF = ADO.NET Entity Framework
ESQL = Entity SQL LINQ = Language Integrated Query CSDL = Conceptual Schema Definition Language SSDL = Store Schema Definition Language MSDL = Mapping Schema Definition Language Lambda Syntax = customer.Select(...) Comprehension Syntax = from c in customer ... SQL = Structured Query Language 

29 Service Operations (Methods)
All in one slide  SQL ESQL “select o from orders” Entity Client ADO.NET Provider Provider Oracle Object Services LINQ to Entities “from o in orders...” Provider Other Entity Data Model Entity Data Model ADO.NET Data services Interceptors (Query, Update) HTTP Custom SSDL SSDL Service Operations (Methods) CSDL MSL SSDL

30 RESTful? Is this “the death of SOAP”? REpresentational State Transfer
Server-side resources identified by a URI Access is over HTTP, verb tied to action GET to read the value of a resource POST to create a new resource PUT to update an existing resource DELETE to delete a resource Returned data is “plain” – XML or JSON Is this “the death of SOAP”?


Download ppt "MSDN Roadshow Rerun Welcome."

Similar presentations


Ads by Google