ADO.NET 3.0 – Entity Data Model Gert E.R. Drapers Chief Software Architect Visual Studio Team Edition for Database Professionals Microsoft Corporation.

Slides:



Advertisements
Similar presentations
Satisfy Your Technical Curiosity ADO.NET vNext The Entity Data Model, Object Services, and LINQ Bob Beauchemin Director of Developer Resources, SQLskills.
Advertisements

Introduction to NHibernate By Andrew Smith. The Basics Object Relation Mapper Maps POCOs to database tables Based on Java Hibernate. V stable Generates.
Chapter 10: Designing Databases
.NET 3.5 SP1 New features Enhancements Visual Studio 2008 SP1 New features Enhancements Additional features/enhancements.
Michael Pizzo Software Architect Data Programmability Microsoft Corporation.
Introduction to Databases
.NET Database Technologies: Open-Source Frameworks.
Jeff Derstadt Senior Development Lead Microsoft Corporation Patterns & Architecture.
Building Enterprise Applications Using Visual Studio ®.NET Enterprise Architect.
.NET Framework V3.5+ & RESTful web services Mike Taulty Developer & Platform Group Microsoft Ltd
File Systems and Databases
The Microsoft Technical Roadshow 2007 Advances for Data in VS “Orcas” Mike Taulty Developer & Platform Group Microsoft Ltd
Information systems and databases Database information systems Read the textbook: Chapter 2: Information systems and databases FOR MORE INFO...
(code name: Data Dude) Josh Robinson Aculix.
Building Ad-Hoc Reports using the SQL Server 2005 Reporting Services (SSRS) Report Builder (SQL307) Adrian Rupp Business Intelligence Solutions Specialist.
A tour of new features introducing LINQ. Agenda of LINQ Presentation We have features for every step of the way LINQ Fundamentals Anonymous Functions/Lambda.
Discover, Master, InfluenceSlide 1 SQL Server Compact Edition and the Entity Framework Rob Sanders Readify.
SQL Server Compact Edition 3.5 and the Entity Framework Rob Sanders and Matt Lynch.
Introduction to ADO Entity Framework ir Denis VOITURON Source:
Eric Nelson Developer & Platform Group Microsoft Ltd
Module 17 Storing XML Data in SQL Server® 2008 R2.
Enterprise Object Framework. What is EOF? Enterprise Objects Framework is a set of tools and resources that help you create applications that work with.
Object Oriented Databases by Adam Stevenson. Object Databases Became commercially popular in mid 1990’s Became commercially popular in mid 1990’s You.
Database System Concepts and Architecture Lecture # 3 22 June 2012 National University of Computer and Emerging Sciences.
Information storage: Introduction of database 10/7/2004 Xiangming Mu.
.NET Database Technologies: Entity Framework additional notes – part 2.
LINQ Boot Camp ADO.Net Entity Framework Presenter : Date : Mahesh Moily Nov 26, 2009.
Entity Framework, a quickstart Florin−Tudor Cristea, Microsoft Student Partner.
Visual Studio ®.NET Data with XML Carlotta Eaton ( Associate Professor of IST New River Community College Slides by Microsoft Modified.
Data Access Patterns Some of the problems with data access from OO programs: 1.Data source and OO program use different data modelling concepts 2.Decoupling.
10-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
ADO.NET ENTITY FRAMEWORK Mike Taulty Developer & Platform Group Microsoft UK
Compiling Mappings to Bridge Applications and Databases Melnik, Adya and Research.
Intro to C#.net and EF Ilan Shimshoni. The Three Faces of ADO.NET The connected layer – Directly connecting to the DB The disconnected layer – Using datasets.
Overview of Data Access MacDonald Ch. 15 MIS 324 Professor Sandvig.
Entity Framework Overview. Entity Framework A set of technologies in ADO.NET that support the development of data-oriented software applications A component.
Ventsislav Popov Crossroad Ltd.. 1. ASP.NET Data Source Controls  SqlDataSource  EntityDataSource  ObjectDataSource 2. Entity Data Model and ADO.NET.
Introduction to LINQ Lecture # 19 August Introduction How do you interrogate/manipulate data? What if you could do the work in a type-safe," string-free.
Information System Development Courses Figure: ISD Course Structure.
ADO.NET Entity Framework Mike Taulty Developer & Platform Group Microsoft Ltd
Lap Around Visual Studio 2008 &.NET 3.5 Enhancements.
Data Management Console Synonym Editor
Module 4 Designing and Implementing Views. Module Overview Introduction to Views Creating and Managing Views Performance Considerations for Views.
Oct * Brad Tutterow. VS 2008.NET 3.5LINQ Entity Framework  The ADO.NET Entity Framework is part of Microsoft’s next generation of.NET technologies.
Ventsislav Popov Crossroad Ltd.. 1. ASP.NET Data Source Controls  SqlDataSource  EntityDataSource  ObjectDataSource 2. Entity Data Model and ADO.NET.
Microsoft FrontPage 2003 Illustrated Complete Integrating a Database with a Web Site.
Copyright 2007, Information Builders. Slide 1 iWay Web Services and WebFOCUS Consumption Michael Florkowski Information Builders.
2 Behind every great site, there is great data Eric Nelson Developer Evangelist Microsoft UK
ASP.net Course From Intermediate to Advance level By Arsalan Ahmed 3 Months Course Cell :
Management system for The Stute The system will manage the day to day operations and website of Stevens’ student newspaper, The Stute.
Exploring Networked Data and Data Stores Lesson 3.
1 Copyright © 2008, Oracle. All rights reserved. Repository Basics.
Fundamental of Database Systems
Building Enterprise Applications Using Visual Studio®
Introduction to Entity Framework
Chris Menegay Sr. Consultant TECHSYS Business Solutions
Entity Framework By: Casey Griffin.
Entity Framework 4 and WCF Data Services 4
ADO.NET Entity Framework Marcus Tillett
ADO.NET Entity Framework
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 2 Database System Concepts and Architecture.
ADO.NEXT Advances in Data Access for 2008
File Systems and Databases
.NET Database Technologies:
Accessing Data in a .NET Web Application
Data Model.
Introduction of Week 11 Return assignment 9-1 Collect assignment 10-1
ADO.NET Entity Framework
.NET Framework V3.5+ & RESTful web services
Presentation transcript:

ADO.NET 3.0 – Entity Data Model Gert E.R. Drapers Chief Software Architect Visual Studio Team Edition for Database Professionals Microsoft Corporation

Agenda ADO.NET Entity Framework Introduction Application Scenarios –Direct Mapping –Flexible Mapping Scenarios –Extensibility Usage Best Practices Summary

The Entity Framework ADO.NET Providers Dataset ADO.NET 2.0 The Entity Data Model Language Integrated Query (LINQ) ADO.NET Providers Entity Client Dataset Object Services LINQ over Dataset LINQ over Entities ADO.NET Entity Framework

ADO.NET Data Providert ADO.NET Data Provider Entity Framework Overview ADO.NET Data Provider Object Services LINQ to Entities EDM MetaData Store Schema Conceptual Schema Conceptual Schema Object Metadata Object Metadata O-C Map O-C Map C-S Map C-S Map CQT DataReader IEnumerable ESQLNative SQL CQT ESQLLINQ EntityClient Data Provider Client View Engine CQT

EDMGEN.EXE Generates the model files Model.ssdl (Store Schema Definition Language) –Describes tables and columns which map to Entities and Relationships Model.csdl (Conceptual Schema Definition Language) –Describes the Entity Data Model (incl. EntitySets, EntityTypes, Associations & AssociationsSets) Model.msl (Mapping Specification Language) –Describes how the Entity Framework maps between the Conceptual Model (CSDL) and the logical Storage Schema (SSDL) Model.cs or Model.vb –Partial class implementing the model created

Direct Mapping Scenario –Database schema provides appropriate application model Benefits –Relationships –Common Extended Query Language –Common Queryable Schema –Common Metadata Services –Object Services Business Logic Identity Management Change Tracking –Language Integrated Query (LINQ)

Flexible Mapping Scenario –Database schema doesn't match application model Benefits –Richer Application Data Model Inheritance M:N Relationships –Richer Mapping Inheritance options (TPH, TPT, TPC) Stored Procedures Entities split across tables –Decouples application model from storage schema Multiple application models for same store Same application model over different storage schemas Independent evolution of application model/storage schema

Extensibility Scenario: Building a customizable framework Benefits –Flexible run-time mappings i.e., Language-specific mappings –Mapping to "Extensible Schemas" EntityViews –Vertical partitioning of framework and extensions Separate mappings Derived types –Extending data classes

Best Practices Should I use Objects or DataRecords? How long should I hold an ObjectContext? Which mapping techniques should I use? When should I used Stored Procedures or Table Valued Functions? How should I extend data classes? When should I write my own data classes? When should I use Custom Serialization? Should I use LINQ, Query Builder Methods, or eSQL? Should I use LINQ to SQL or LINQ to Entities?

Objects or DataRecords? Objects (IEnumerable ) –Strong typing –Business logic –Updating –Example: Interactive Windows application Data Records (IExtendedDataReader) –Performance for read-only streaming Sequential access Avoid object construction overhead Doesn't require generated classes –Example: Directly serializing results to a Web response

Holding ObjectContext Web scenarios –Typical pattern: Create, Use, dispose –ObjectContext holds resources Connections Object References –Use NoTracking for read-only scenarios Windows Forms scenarios –Hold as long as application interacts with results –ObjectContext mantains state Identity resolution Change tracking –New ObjectContext for each new query Ensures data is fresh

Mapping Techniques Database views –Common access patterns across applications Optimization of access paths through Materialized Views Table/View mappings –Entity properties map directly to database columns Columns have same meaning throughout hierarchy EntitySQL views in MSL –Flexible mappings expressed in EntitySQL Filter based on conditions, read-only properties, non- equality conditions, computed properties, multiple extents mapped to same table Native SQL views in SSDL –Mapping on top of native SQL queries Store-specific queries Expose as "EntitySet" to mapping layer

Stored Procedures and TVFs Stored Procedures –Better control over operations on data within the database Tighter control over operations, permissions Provides level of indirection from storage schema –Use for operations that affect state of the database Inserts, updates, deletes Required for updates against ESQL and Native SQL views –Can return multiple results in one roundtrip Tabled Valued Functions –Better control over access to data within the database Tighter control over operations, permissions Provides level of indirection from storage schema –Use for server-side functions that return data Results of TVF are composable within a query

Extending Data Classes Derivation –Adding new persistent fields to a base class Derived types Customization extensions Partial Classes –Business logic –Methods –Calculated values –Non-persistent fields –Custom serialization "Activity" Classes –Common operations on data classes

Custom Data Classes Entity Framework-generated data classes –Derive from Entity Framework base class Change Tracking, RelationshipManagement Common Notifications, Property Validation Custom data classes –Derive from Entity Framework base class Generate common patterns Insert common intermediate class –Derive from your own base class Implement IEntity/IEntityWithRelationships –Expose EntityKey –Notify ObjectContext when data changes –RelationshipManager property to do relationship fixup Add attributes for persistent fields –How we get O/OC metadata today –Investigating "Persistence Ignorance" scenarios

Custom Serialization Default serialization –Serialize streams of Entities Doesn't navigate relationships in order to avoid cycles Custom serialization –Serialize Graphs Manage relationship serialization to avoid cycles –Serialize to different shapes "Entity Projections"

LINQ, Query Builder, or eSQL? LINQ –Strongly typed queries –Compile-time checking –Embedded in your application –LINQ-Mapped Canonical Functions ObjectQuery builder methods –Queries built from user input –Iterative query building –Store functions eSQL –Dynamic/AdHoc queries –Persistent queries –Store functions

LINQ to SQL or LINQ to Entities? LINQ to SQL –Emphasis on rapid application development –Direct mapping Single type hierarchy to single table/view/stored proc/TVF Simple renaming Derive class for update logic/Stored Procedures –Direct mapping to Microsoft SQL Server family of databases –Microsoft Visual Studio 2008 RTM

LINQ to SQL or LINQ to Entities? LINQ to Entities –Focus on enterprise-grade data scenarios –Flexible Mapping to Relational data Mapping a single class across multiple tables/views Mapping to different types of inheritance Directly modeling Many to Many relationships Mapping to an arbitrary query against the store Common model across products Declarative stored procedures –Access to Microsoft SQL Server family and other databases through ADO.NET provider model –Microsoft Visual Studio 2008 update

The LINQ Project C# 3.0C# 3.0 VB 9.0VB 9.0 OthersOthers.NET Language Integrated Query LINQ to Objects LINQ to DataSets LINQ to SQL LINQ to Entities LINQ to XML Objects XML Relational

Summary Entity Data Model provides an application-oriented data model –Entities and relationships Strong typing, polymorphism Client Views provide flexible mapping to your storage schema –Entities split between tables, Many:Many relationships, mapping to store queries, etc. Entity Framework lets you opt-in according to your requirements –DataReaders/Objects –eSQL/QueryBuilder/LINQ –Generated/Custom Data Classes

? Questions ?