La présentation est en train de télécharger. S'il vous plaît, attendez

La présentation est en train de télécharger. S'il vous plaît, attendez

Introduction à Entity Framework

Présentations similaires


Présentation au sujet: "Introduction à Entity Framework"— Transcription de la présentation:

1 Introduction à Entity Framework
3/30/ :05 PM Introduction à Entity Framework Bernard Fedotoff Consultant .NET & Microsoft Regional Director Agilcom © 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.

2 Agenda Présentation d’Entity Framework Principe du mappage
Entity Client & Object Service Entity Framework vs Linq-to-SQL ? Question Performance

3 Entity Framework Introduction
Livré avec le SP1 de .Net 3.5 ; C’est un composant d’ADO.NET ; « Entity Framework » aide le développeur à abstraire les données dans un modèle conceptuel ; L’interaction avec le modèle est réalisée au travers d’un nouveau fournisseur de données « EntityClient » Indépendant de la base de données cible (Sql Server, Oracle, MySql, PostGreSql, SqlLite, NpgSql, Sybase, DB2, Informix, U2, etc.)

4 Entity Framework Le modèle
Modèle de stockage Mappage Modèle conceptuel Shéma des objets de la base de données Schéma du modèle des entités de données *.SSDL *.MSL *.CSDL Base de données Classes objets SSDL : Store Schema Definition Language MSL : Mapping Schema Language CSDL : Conceptual Schema Definition Language XML

5 Entity Framework Les outils de Visual Studio 2008 SP1
L’assistant « Entity Data Model » Génère un modèle à partir d’une base de données existante (en ressource) ; Génère la chaine de connexion au modèle ; Génère le code (C# ou VB.NET) des classes basées sur le modèle conceptuel ; Le Designer d’entités « Entity Designer » Créé ou modifie un modèle complet ; L’assistant de mise à jour Aide à mettre à jour un modèle en cas de changement de la base de données ;

6 Entity Client C’est un modèle d’objet ADO.NET
EntityCommand EntityConnection EntityDataReader EntityParameter EntityTransaction Comme ADO.NET, les résultats sont retournés sous forme d’un flux texte, lu avec un DataReader Entity Client propose un accès rapide mais en lecture seulement sur le modèle d’entités ; Les requêtes sont écrites en Entity SQL ;

7 Entity SQL C’est un langage proche du T-SQL
Il cible le modèle conceptuel Il est indépendant de la base de données sous-jacente T-SQL Entity SQL

8 Les objets du service Les objets générés représentent des requêtes :
ObjectContext ObjectQuery<T> Ces objets sont construits au dessus d’Entity Client (les requêtes sont traduites en Entity-SQL) ; Les requêtes s’expriment en utilisant Entity-SQL ou LINQ ;

9 Le mappage La modélisation propose des possibilités de regrouper / dégrouper les tables et les entités : Héritage TPT (Table per Type Inheritance) C’est la modélisation d’un héritage entre des entités qui sont chacune mappée vers une table distincte ; Dégroupage d’entités (Entity Splitting) C’est la modélisation d’une seule entité dont les informations proviennent de plusieurs tables ; Héritage TPH (Table per Hierarchy Inheritance) C’est la modélisation de plusieurs entités dont les informations proviennent de la même table : dans ce cas une colonne discriminante est précisée ;

10 Entity Framework vs Linq-to-Sql
Framework .Net .NET 3.5 SP1 .NET 3.5 Méta Données Fichiers SSDL, CSDL, MSL au format XML Attributs de classe Mappage Plusieurs scénarios possibles Mappage « un pour un » Designer Génération, Mise à jour du modèle, etc. Assistant de génération Bases de données cibles SQL Server, Oracle, MySql, Db2, etc. SQL Server Requêtes Entity-SQL, LINQ LINQ Linq-to-Sql devrait être intégré à Entity Framework dans un futur proche.

11 La performance D’un point de vue SQL La génération des vues
Génération des requêtes T-SQL par l’objet de Context qui analyse l’Entity-SQL ; T-SQL dans le cas où il n’y a pas de paramètre ; sp_executesql dans le cas de paramètres ; Mappage possible sur des procédures stockées ; La génération des vues Avant d’exécuter une requête sur un modèle, EF doit générer des vues locales ; Le coût de cette génération est fort ; Possibilité de générer ces vues avec EdmGen.Exe EdmGen.exe /nologo /language:CSharp mode:ViewGeneration /inssdl:<ssdl> /incsdl:<csdl> /inmsl:<msl> /outviews: <cs>

12 Intérêt de Entity Framework
Modèle simple et rapide de développement de couche d’abstraction des données ; Entity-SQL est indépendant de la base de données cible ; .NET propose des services d’exposition d’un modèle conceptuel : ASP.NET Dynamic Data ADO.NET Dynamic Data Evolution des modèles vers SQL DataService (Windows Azure et Cloud Computing) ;

13 Rappel Présentation d’Entity Framework Principe du mappage
Entity Client & Object Service Entity Framework vs Linq-to-SQL ? Question Performance

14 Plus d’informations Kit de formation pour .Net 3.5 SP1 :
Page d’accueil EF Les providers du marché Les outils Les blogs Du code Les vidéos de la PDC 2008

15 Save the date for tech·days next year!
3/30/ :05 PM Save the date for tech·days next year! 14 – 15 avril 2010, CICG © 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.

16 Premium Sponsoring Partners
3/30/ :05 PM Premium Sponsoring Partners Classic Sponsoring Partners © 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 3/30/ :05 PM © 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.


Télécharger ppt "Introduction à Entity Framework"

Présentations similaires


Annonces Google