ADO.NET Entity Framework Marcus Tillett

Slides:



Advertisements
Similar presentations
January 30, 2014 Copyright Jim Farley Beyond JDBC: Java Object- Relational Mappings Jim Farley e-Commerce Program Manager GE Research and Development
Advertisements

An Object/Relational Mapping tool Free and open source Simplifies storage of object data in a relational database Removes the need to write and maintain.
.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.
Database Systems: Design, Implementation, and Management Tenth Edition
.NET Database Technologies: Open-Source Frameworks.
The Microsoft Technical Roadshow 2007 Advances for Data in VS “Orcas” Mike Taulty Developer & Platform Group Microsoft Ltd
05 | Data Access with Entity Framework Bruno Terkaly | Technical Evangelist Bret Stateham | Technical Evangelist.
Discover, Master, InfluenceSlide 1 SQL Server Compact Edition and the Entity Framework Rob Sanders Readify.
Introduction to ADO Entity Framework ir Denis VOITURON Source:
Test Driven Development using Visual Studio Team System Ariel Gur-Arieh VP R&D – MCD Software Solutions
1 Entity Framework Introduction. Outline Goals of Entity Framework 2.
Databases and LINQ Visual Basic 2010 How to Program 1.
LINQ Boot Camp ADO.Net Entity Framework Presenter : Date : Mahesh Moily Nov 26, 2009.
Entity Framework, a quickstart Florin−Tudor Cristea, Microsoft Student Partner.
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.
CHAPTER 14 USING RELATIONAL DATABASES TO PROVIDE OBJECT PERSISTENCE (ONLINE) © 2013 Pearson Education, Inc. Publishing as Prentice Hall 1 Modern Database.
Entity Framework Overview. Entity Framework A set of technologies in ADO.NET that support the development of data-oriented software applications A component.
ADO.NET Entity Framework Mike Taulty Developer & Platform Group Microsoft Ltd
Lap Around Visual Studio 2008 &.NET 3.5 Enhancements.
1 Mapping to Relational Databases Presented by Ramona Su.
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.
ADO.NET 3.0 – Entity Data Model Gert E.R. Drapers Chief Software Architect Visual Studio Team Edition for Database Professionals Microsoft Corporation.
CSCI 3327 Visual Basic Chapter 13: Databases and LINQ UTPA – Fall 2011.
2 Behind every great site, there is great data Eric Nelson Developer Evangelist Microsoft UK
Hibernate Java Persistence API. What is Persistence Persistence: The continued or prolonged existence of something. Most Applications Achieve Persistence.
Joy Rathnayake Senior Architect – Virtusa Pvt. Ltd.
Building Enterprise Applications Using Visual Studio®
New Technology: Why, What ,How
Visual Basic 2010 How to Program
Introduction to Entity Framework
Introduction to ASP.NET 2.0
A very brief introduction
Chris Menegay Sr. Consultant TECHSYS Business Solutions
Visual C# 2005: IDE Enhancements
6/19/2018 © 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks.
Database Management System
Visual Studio Tools for Office 2005
Enterprise Library Overview
Entity Framework By: Casey Griffin.
Azure API Management Jothi Prakash A
Chapter 4 Relational Databases
Searching Business Data with MOSS 2007 Enterprise Search
Microsoft Dynamics.
Entity Framework 4 and WCF Data Services 4
ADO.NET Entity Framework
Microsoft Build /10/2018 1:35 AM © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY,
CS 174: Server-Side Web Programming February 12 Class Meeting
ADO.NEXT Advances in Data Access for 2008
Introduction to Database Management System
.NET Database Technologies:
Accessing Data in a .NET Web Application
Introduction to Building Applications with Windows Azure
Data Model.
What's New in Visual Studio 2005
Metadata Framework as the basis for Metadata-driven Architecture
Visual Studio 2005 Tools For Office: Creating A Multi-tier Application
Visual Studio 2010 SharePoint Development Tools Overview
SSDT and Database Project Basics
Microsoft Connect /23/ :38 AM
TechEd /3/ :48 PM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks.
Microsoft Office System UK Developers Conference
DEV322 Visual Studio 2005 C# IDE Enhancements
ADO.NET Entity Framework
Oracle SQL Developer Data Modeler
Windows Forms in Visual Studio 2005: An in-depth look at key features
Windows Forms in Visual Studio 2005: An Overview
Mark Quirk Head of Technology Developer & Platform Group
9/8/ :03 PM © 2006 Microsoft Corporation. All rights reserved.
9/14/2019 6:51 AM © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Presentation transcript:

ADO.NET Entity Framework Marcus Tillett 0:21 My name is Marcus Tillett And I’m a Senior Software Architect at Dot Net Solutions, Based here in Windsor I’m going to talk about the ADO.NET Entity Framework Part of .NET 3.5, currently in beta Next: First, I want to have a brief look at the Entity framework And look at where it is applicable

Overview Introduction to ADO.NET Entity Framework Using the Visual Studio Tools 0:42 First, I want to have a brief look at the Entity framework. And look at where it is applicable Then, taking an example I want to look how you would do this using the tools in Visual Studio. My title refer to OO Architect vs. Data Architect. Next: This is because My requirement is to take advantage OO concepts, such as inheritance, when writing applications but to persist the data in a relational database

OO Architect vs. Data Architect 22/09/2018 2:27 PM OO Architect vs. Data Architect Requirement to use an OO language to manipulate entities persist these in a relational database Impedance mismatch 1:03 My aim is to take advantage OO concepts, such as inheritance, when writing applications but to persist the data in a relational database Impedance mismatch is a broad term. Here I am using it to refer to the fact that relational databases are not good at storing OO concepts This is where the ADO.NET entity framework steps in. Next: What the ADO.NET entity framework does is provide a level of abstraction from the data. 3 © 2006 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

ADO.NET Entity Framework 1:24 What the ADO.NET entity framework does is provide a level of abstraction from the data. Shown in RED at the BOTTOM And give an API to manage the manipulate the entities it provides This is a diagram of the framework and I going to briefly discuss each part of the model Next: First, the logical model The logical model is a representation of the database schema.

Logical Model Logical layer stored as schema definition language (SSDL) 1:45 First, the logical model The logical model is a representation of the database schema. The logical model might contain a representation of each table in the database It can also represent views

Conceptual Model Conceptual model is an Entity Data Model (EDM) schema stored using conceptual schema definition language (CSDL) 2:06 The conceptual model contains entities. So here in the conceptual model I have 2 entities. These are the class that are exposed to develop against and is the API for the entity framework Next: Most importantly is the mapping layer.

Mapping A mapping specification uses mapping specification language (MSL) to connect the types declared in CSDL to the database metadata declared in SSDL 2:27 Most importantly is the mapping layer. This stores the mappings between the entities in the conceptual model against the tables in the logical model This is a specification language, as are all the parts of the model defined in separate definition languages This is stored in XML, again this applied to the other part of the model

MSL Mapping 2:48 This is a snippet of the XML schema for the MSL. The mapping definition language. This shows the mapping between an entity Person and the database representation of this entity. And maps a name property on the entity to a Name column in the database table Next: Now with the entity model, I can create business logic on top of the conceptual model.

Business Logic 3:09 Now with the entity model, I can create business logic on top of the conceptual model. My business object can interact with any number of the entities and not directly with the database To use the entity framework, Now I want to look at an example. This example is part of the impedance mismatch that I mentioned earlier. In this example I want to look at an inheritance structure.

Example: Required Entity Model 22/09/2018 2:27 PM Example: Required Entity Model 3:30 Now I have my entity framework, I want to look at storing this class structure in a relational database. I have 4 classes in a very basic inheritance structure: Person, Employee, Broker and Applicant. There are a number of technical of doing this. Next: Table per type 10 © 2006 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

22/09/2018 2:27 PM Table per Type 3:51 I have chosen to use table per type, each class has a corresponding table in the data model. Normalised There is no duplication of data between these tables, for instance the Name column only appears on the Person table Next: Viewed on top of the entity model framework. http://martinfowler.com 11 © 2006 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

Table per Type 4:12 Viewed on top of the entity model framework. 22/09/2018 2:27 PM Table per Type 4:12 Viewed on top of the entity model framework. Each one of my classes is represented in the conception model These map to the same number of tables in my logical model The mapping being handled by the mapping layer. What I can do is reserve engineer these entities from my data model 12 © 2006 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

Visual Studio Designer 22/09/2018 2:27 PM Visual Studio Designer 4:33 If I reverse engineer my entity model from the database, I produces this. I has not understand that I am trying to store an inheritance structure in my database. This is fair enough Next: I need to do some extra work 13 © 2006 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

22/09/2018 2:27 PM Remove Relation 4:54 I have to do a bit of work to finish building my entity model. From my entity model, I need to delete the relationships between the class. This is from the entity model, these constraints are still in the database. I also need to remove the key from the sub classes. Next: Then I can add by inheritance in. 14 © 2006 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

22/09/2018 2:27 PM Adding Inheritance 5:15 I can now add in the inheritance relationship for each of the sub classes. Here I am adding the Person as a base class for the Employee Next: Nearly done, but most importantly I need to create the mappings 15 © 2006 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

Mapping Entities 5:36 For each of the classes in the entity model. 22/09/2018 2:27 PM Mapping Entities 5:36 For each of the classes in the entity model. I need to map that entity to the table in the database. Here I am mapping the Employee table to the Employee entity The Id is inherited from the super class. So I can map it to the primary key in the database Next: That’s it I have my entities. I can now use them 16 © 2006 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

Using the Entities 5:57 Now I have build my entities, I can use them. 22/09/2018 2:27 PM Using the Entities 5:57 Now I have build my entities, I can use them. I might write some code that is something like this. Here I can creating a broker, saving and then fetching from the entity framework. All without dealing with database objects. Next: The last thing I want to show is that I can evolve my data model and therefore my logical model without changing my entities. 17 © 2006 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

Table per Hierarchy 6:18 I could store my whole hierarchy in a single table. In effect, all I need to do is update the model and provide the new mappings. But it requires a little more work. Next: In summary The entity framework provides a separation between the classes that are developed against and the tables in the database.

Summary ADO.NET Entity Framework provides a separation between the data and the entity Supports different inheritance modelling patterns Enables refactoring of data model 6:39 In summary The entity framework provides a separation between the classes that are developed against and the tables in the database. It supports different way to store inheritance structures Lastly, as I have shown always for a level of refactoring of the data model without changing the API

Summary http://www.vistasquad.co.uk More information http://blogs.msdn.com/adonet/ 6:59 Finally, a plug for vista squad a free Microsoft sponsor user group. I’ll be speaking there soon a little more in depth about the ADO.NET entity framework. Thank you for listening.