Object Relational Mapping – ORM Entity Framework

Slides:



Advertisements
Similar presentations
Introduction to NHibernate By Andrew Smith. The Basics Object Relation Mapper Maps POCOs to database tables Based on Java Hibernate. V stable Generates.
Advertisements

Entity Framework Code First Migrations
Jacinto Limjap, Jr. Senior Software Design Engineer, Cormant Technologies Inc. LINQ for NHibernate { Easy OR Mapping with C# and Visual Studio 2008 }
1. 2 Captaris Workflow Microsoft SharePoint User Group 16 May 2006.
.NET Database Technologies: Open-Source Frameworks.
DEVELOPING APPLICATIONS WITH LINQ 2 SQL Sidar Ok
The Jukebox Orian Paz & Yair Cleper Instructor: Viktor Kulikov Semester: Spring 2009 Final Presentation.
05 | Data Access with Entity Framework Bruno Terkaly | Technical Evangelist Bret Stateham | Technical Evangelist.
Session-01. Hibernate Framework ? Why we use Hibernate ?
SQL Server 2008 Basmah AlQadheeb-213 MIS What is a Database ? A database is a collection of Data that is organized so that it can easily be accessed,
Entity Framework Code First End to End
ORM Shootout Howard Richards
PHP Data Object (PDO) Khaled Al-Sham’aa. What is PDO? PDO is a PHP extension to formalise PHP's database connections by creating a uniform interface.
Entity Framework, a quickstart Florin−Tudor Cristea, Microsoft Student Partner.
Intro to Entity Framework By Shahed Chowdhuri Don’t drown in database design during WakeUpAndCode.com.
Entity Framework MIS 324 MIS 324 Professor Sandvig Professor Sandvig.
ADO.NET ENTITY FRAMEWORK Mike Taulty Developer & Platform Group Microsoft UK
Eric Nelson (or )
NHibernate in Action Web Seminar at UMLChina By Pierre Henri Kuaté 2008/08/27
CHAPTER 14 USING RELATIONAL DATABASES TO PROVIDE OBJECT PERSISTENCE (ONLINE) © 2013 Pearson Education, Inc. Publishing as Prentice Hall 1 Modern Database.
M1G Introduction to Database Development 6. Building Applications.
.NET Database Technologies: Data Models and Patterns.
Object-relational mapping Author: Jaroslav Orság Diploma thesis supervisor: Ing. Augustín Mrázik.
© 2011 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 14 Using Relational Databases to Provide Object Persistence (Overview) Modern Database.
(1) Introduction to Models using the Play Framework Philip Johnson Collaborative Software Development Laboratory Information and Computer Sciences University.
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.
EntityFrame work and LINQ CH 14. linq LINQ enables you to query data from a wide variety of data sources, directly from your programming code. LINQ is.
Course FAQ’s I do not have any knowledge on SQL concepts or Database Testing. Will this course helps me to get through all the concepts? What kind of.
PHP Workshop ‹#› PHP Data Object (PDO). PHP Workshop ‹#› What is PDO? PDO is a PHP extension to formalise PHP's database connections by creating a uniform.
Entity Framework 7 Who Are You & What Have You Done to my ORM?
Entity Framework 7: What’s New? Ricardo Peres Technical Evangelist at Simplifydigital. Microsoft
Sean Chambers.  ORM stands for Object Relational Mapper  Maps your POCO (plain old clr objects) to your relational model using XML config  Relieves.
The Jukebox is a.NET web application that plays streaming music files to it’s clients according to their favorites musical genres. Clients can rate the.
Hibernate Java Persistence API. What is Persistence Persistence: The continued or prolonged existence of something. Most Applications Achieve Persistence.
Top 10 Entity Framework Features Every Developer Should Know
Integrating Data Lesson 6.
DevOps with ASP.NET Core and Entity Framework Core
Introducing the Microsoft® .NET Framework
New Technology: Why, What ,How
Introduction to Entity framework
Introduction to .NET Florin Olariu
Introduction to Entity Framework
5/15/2018 © 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks.
LINQ for SQL SQL Saturday May 2009 David Fekke.
LiNQ SQL Saturday David Fekke.
 .NET CORE
Did your feature got in, out or planned?
Entity Framework By: Casey Griffin.
ICT Database Lesson 1 What is a Database?.
Entity Framework Core for Enterprise Applications
Learn. Imagine. Build. .NET Conf
ADO.NET Entity Framework Marcus Tillett
ADO.NET Entity Framework
Database Management Systems
ADO.NEXT Advances in Data Access for 2008
An Introduction to Entity Framework
.NET Database Technologies:
Entity Framework Core.
Accessing Data in a .NET Web Application
Entity Framework Core (EF Core)
Entity Framework Code-First Migrations
Entity Framework Core for Enterprise Applications
Database Management Systems
Data Structures and Database Applications ACST 3330
Implementing Entity Framework with MVC Jump Start
Visual Studio + SQL Server Is Better
Entity Framework & LINQ (Language Integrated Query)
Visual Studio 2010 and .NET Framework 4 Training Workshop
Writing Clean & efficient data access code with ADO
Presentation transcript:

Object Relational Mapping – ORM Entity Framework C# kursus Rohde & Schwarz

ORM? C# kursus Rohde & Schwarz

Objects vs. Relations C# kursus Rohde & Schwarz

Object-Relational Impedance Mismatch Object-Oriented Relational Based on proven software engineering principles. Entry point is behaviour Object collections and associations derived from graph theory Based on proven mathematical principles. Entry point is data Data collections and associations derived from set theory C# kursus Rohde & Schwarz

A Physical Data Model Both diagrams depict structure, the PDM shows four database tables and the relationships between them whereas the UML class diagram shows four classes and their corresponding relationships. Both diagrams depict data, the PDM shows the columns within the tables and the class model the attributes of the classes. Both diagrams also depict behavior, the Customer table of Figure 1 includes a delete trigger and the Customer class of Figure 2 includes two operations. C# kursus Rohde & Schwarz

A Class Model Both diagrams depict structure, the PDM shows four database tables and the relationships between them whereas the UML class diagram shows four classes and their corresponding relationships. Both diagrams depict data, the PDM shows the columns within the tables and the class model the attributes of the classes. Both diagrams also depict behavior, the Customer table of Figure 1 includes a delete trigger and the Customer class of Figure 2 includes two operations. C# kursus Rohde & Schwarz

Differences Physical Data Model Class Model Differences in your modeling approaches will result in subtle differences between your object schema and your data schema: By considering both data and behavior in the class diagram the modeler created a different structure than in the data model that only considered data  Data normalization in data modeling versus class normalization in class modeling The application of data analysis patterns (Hay 1996) versus object-oriented analysis patterns (Fowler 1997; Ambler 1997) and design patterns (Gamma et. al. 1995) There are differences in the types of relationships that each model supports, with class diagrams being slightly more robust than physical data models for relational databases.  This is because of the inherent nature of the technologies.  For example, you see that there is a many-to-many relationship between Customer and Address in Figure 2, a relationship that was resolved in Figure 1 via the CustomerAddress associative table.  Object technology natively supports this type of relationship but relational databases do not, which is why the associative table was introduced.  C# kursus Rohde & Schwarz

Benefits Of O/R Mapping Clean OO design Hiding the relational model specifics lets the object model be more cleanly analyzed and applied. Productivity Simpler code as the object model is free from persistence constraints. Developers can navigate object hierarchies, etc. Separation of concerns and specialization Let the DB people worry about DB structure and the Object people worry about their OO models. Time savings The O/R mapping layer saves you from writing the code to persist and retrieve objects. O/R mapping tool vendors claim 20-30% reduction in the code that needs to be written. Writing less code also means less testing. C# kursus Rohde & Schwarz

Drawbacks Of O/R Mapping Usually commit the "Needless Repetition" deadly sin (a.k.a. DRY – "Don't Repeat Yourself“) The table structure as well as their relations are stored both in the DB and in the mapping files used by the O/R mapper Writing mapping files is a huge task Needs to be updated every time the database layout is changed Queries Limited query capabilities… … or performance problems on complicated queries Some O/R mappers implement caches, lazy initialization, batch modes etc. to help avoid the performance problems C# kursus Rohde & Schwarz

Entity Framework C# kursus Rohde & Schwarz

Entity Framework What is Entity Framework? Entity Framework (EF) is an object-relational mapper that enables .NET developers to work with relational data using domain-specific objects. It eliminates the need for most of the data-access code that developers usually need to write. http://msdn.microsoft.com/en-us/data/ef.aspx C# kursus Rohde & Schwarz

Supported Databases MS SQL Server MySQL SQLite Oracle Firebird PostgreSQL ... and more C# kursus Rohde & Schwarz

Getting Started EF supports four development workflows: http://msdn.microsoft.com/en-us/data/jj590134 Find out which fits your conditions: http://msdn.microsoft.com/en-us/data/ee712907 C# kursus Rohde & Schwarz

Installation Pre installed with Visual Studio 2012 Can be installed with NuGet in Visual Studio 2010 You might need to install NuGet first... C# kursus Rohde & Schwarz

Using Entity Framework Create a mapping of your database Entity Data Model (Model First) Database migrations not possible (yet) Plain Old CLR Objects (POCO) (Code First) Database migrations possible C# kursus Rohde & Schwarz

Using Entity Framework Connect through a sub class of DbContext Make queries using LINQ C# kursus Rohde & Schwarz

Demo C# kursus Rohde & Schwarz