Download presentation
Presentation is loading. Please wait.
Published byBerenice Golden Modified over 9 years ago
1
Object Relational Mapping A to Z
2
About Me Over A Decade of I.T. Experience Web Developer, DBA, DevOps, Mobile Microsoft Cert. in SQL Server Twitter: @greeleygeek E-Mail: anthem001@gmail.com
3
Summary What an Object Relational Mapper Is Why you might use an Object Relational Mapper Problems using Object Relational Mapper Solutions to common issues Popular Object Relational Mapper examples Debugging Final Tips
4
What Is It? Wikipedia: …”technique for converting data between incompatible type systems in object- oriented programming languages. This creates, in effect, a ‘virtual object database’ that can be used from within the programming language”type systemsobject- orientedobject database “Maps” set based data to objects useable by Object Oriented languages.
5
What Is An ORM
6
What is An ORM? © Universal Studios. All rights Reserved.
7
What Is An ORM? Database Management Systems: ~1960 Object Oriented Programming: ~50s/60s One of the first ORMs was TopLink for SmallTalk in 1994
8
Popular Flavors
9
What Is An ORM?
10
Object Impedance Mismatch Wikipedia defines this as: “…conceptual and technical difficulties that are often encountered when a relational database management system (RDBMS) is being used by a program written in an object- oriented programming language or style; particularly when objects or class definitions are mapped in a straightforward way to database tables or relational schemata.”relational database management systemobject- orientedprogramming language
11
The “ORM problem” http://upload.wikimedia.org/wikipedia/commons/7/76/Bruce_Crandall%27s_UH-1D.jpg
12
Solutions Abandon the Object Model altogether returning to traditional methods Use a storage method that is object oriented itself (OODBMS, NoSQL possibly) Hand-crafting each Mapping Mix of ORM and SQL Integrate datasets into language itself (think LINQ) Build solution on relational concepts (blocks of data)
13
The Good News
14
Taking A Peek
15
NHibernate Demo
18
NHibernate
19
NHibernate Demo
21
Nhibernate Demo
22
NHibernate Demo
23
Taking A Peek
24
Entity Framework
35
Micro ORM Slimmed down ORMs What they lack in features they make up for in speed Popular flavors are PetaPoco and Dapper
36
Massive
40
Massive Demo
41
Debugging An ORM Demo
42
ORM Pros Simpler for developers Supports many database platforms Supports many different languages The impedance mismatch is handled for us Developer can focus on the code, not the database
43
ORM Cons Can be cumbersome to set up (NHibernate) Joins and complex queries can be difficult Hard to read performance metrics Another layer between the database and the application.
44
Final Thoughts ORMs continue to advance Work for most solutions Consider stored procedures or views for finer control.
45
Code Links NHibernate Demo Source Code: https://github.com/anthem001/NHibernateDemo Entity Framework Demo Source Code: https://github.com/anthem001/EntityFrameworkDemo Massive Micro ORM Demo Source Code: https://github.com/anthem001/MassiveORMDemo Slides posted at: http://zero1design.com Twitter: @greeleygeek E-Mail: anthem001@gmail.com
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.