SlideShare a Scribd company logo
R E F O R MDeath to ORMs in .NET
“A Propos de Moi”@kouphaxhttp://github.com/kouphaxhttp://yobriefca.se
DisclaimerThis presentation is full of opinion.  My opinion.  The fact is ORMs have been around for a long time and will be for a while yet.  If things were as simple as I portray them in this presentation you wouldn’t be using them today.   But you probably are.All I ask is that you never blindly use an ORM or any technology without prior brain thinking™
On with the show…
ORMs are for Life…So you’ve adopted an ORM, possiblyNHibernateMyBatisEntity FrameworkThe samples, blogs and demos promise you a better life, your “hello world” grade apps are easy and it adds another shiny buzzword to your CV (Resume Driven Development)You dive right in investing a heap of development cycles, things start out well…
Suddenly and Without Warning…
The Cracks Start To ShowLeaky AbstractionsBugger to debugForced to work for the ORM rather than the ORM working for youDBAs begin to call you namesCode generation and heavy use of model-polluting attributes bog you downCost of change is highOverreliance on ORMs make you dumb
refORM: Death to ORMs in .NET
ORMs in .NET – More Like WTFsNHibernateHQL – WTF?MyBatisXML as a medium for SQL? – WTF?Entity FrameworkGreat demoware but the reality is more like WTF?
Lets Be HonestHow many features of a heavyweight ORM do you really use regularly?  80%? 20%? 10%?How many of these features exist purely to support the abstraction?How difficult is the mapping between DB’s and objects really? Isn’t SQL the best DSL for working with data in a relational database?
So why is this abstraction necessary?
It isn’t.
Historically speaking the alternatives were pretty slim.  Most people would need to roll their own project specific data access layerMany ORMs grew out of that sort of thinking but from a community that thought XML was sexySome people are weirdThe world is a saner place these days.  Reflection is fasterStatically typed languages have embraced dynamics, and,most people realise XML is a noisy medium for almost everything
The Advent of Micro ORMs
Level of AbstractionMicro ORMsHeavyweight ORMs
Dapper
DapperCreated by Sam Saffron of StackoverflowSingle file (available on Nuget)Set of extension methods to IDbConnectionSupports most .NET ADO providersSQL Server, Oracle, SQLite, MySQL, SQL CE Works on boths POCOs and dynamic objectsPretty close to the metalNo connection handlingNo helpers for INSERT, DELETE, UPDATE etc.Community extensions for CRUD operations.NET 3.5 support
Demo
QueriesDapper
Inserts, Updates & DeletesDapper
Inserts, Updates & Deletes (CE)Dapper
Dapper is very close to the metalVery little in the way of providing helpers for 1..N, N..N relationshipsDapper Community Extensions bridge some of the mental gap for people not used to SQLDapperAnd the rest…
ORMLite
ORMLitePart of the ServiceStack technology suiteSet of CRUD extensions around System.Data.* namespaceCurrently supports SQLite and SQL ServerMaps data to and from concrete POCOsVia conventionVia attributes on the POCO – preferredVia raw SQLRelies heavily on POCO attributionSupports .NET 3.5
Demo
ConfigurationORMLite
QueriesORMLite
Inserts, Updates & DeletesORMLite
ORMLite also allows you to create tables from entitiesEach model must have an Id property which must be its primary key.Integrates into the rest of the ServiceStack technology stackORMLiteAnd the rest…
Massive
MassiveCreated by Rob ConreySingle file (available on Nuget)Makes extensive use of dynamicsNo mapping to POCOs for queriesPrefers to wrap tables rather than entitiesProvides a single point of configurationNo need for attributesOOTB Paging support.NET 4 Only
Demo
Creating the Dynamic ModelMassive
QueriesMassive
Inserts, Updates & DeletesMassive
ValidationsEventsAlso Github says…Asynchronous support for queriesAbility to reflect Schema MetadataAbility to generate a (DB) default rowFactory method for ad hoc/on the fly queriesMassiveAnd the rest…

More Related Content

What's hot (15)

PDF
Real Time Graph Computations in Storm, Neo4J, Python - PyCon India 2013
Sonal Raj
 
PPTX
Apache Storm Internals
Humoyun Ahmedov
 
PDF
Hierarchical Systems Policy Management in a Puppet/LDAP Environment
Puppet
 
PDF
Storm: The Real-Time Layer - GlueCon 2012
Dan Lynn
 
PDF
Storm - As deep into real-time data processing as you can get in 30 minutes.
Dan Lynn
 
PDF
Storm Real Time Computation
Sonal Raj
 
PPTX
Progress report2 eliza_cani_3217
Eliza Cani
 
PDF
Pharo Status ESUG 2014
Marcus Denker
 
PDF
PharoDAYS 2015: Pharo Status - by Markus Denker
Pharo
 
PDF
Terraform Best Practices - DevOps Unicorns 2019
Anton Babenko
 
PPTX
Resource Aware Scheduling in Apache Storm
DataWorks Summit/Hadoop Summit
 
PDF
Real-time Big Data Processing with Storm
viirya
 
PDF
Storm: Distributed and fault tolerant realtime computation
Ferran GalĂ­ Reniu
 
PDF
Apache Storm
Nguyen Quang
 
Real Time Graph Computations in Storm, Neo4J, Python - PyCon India 2013
Sonal Raj
 
Apache Storm Internals
Humoyun Ahmedov
 
Hierarchical Systems Policy Management in a Puppet/LDAP Environment
Puppet
 
Storm: The Real-Time Layer - GlueCon 2012
Dan Lynn
 
Storm - As deep into real-time data processing as you can get in 30 minutes.
Dan Lynn
 
Storm Real Time Computation
Sonal Raj
 
Progress report2 eliza_cani_3217
Eliza Cani
 
Pharo Status ESUG 2014
Marcus Denker
 
PharoDAYS 2015: Pharo Status - by Markus Denker
Pharo
 
Terraform Best Practices - DevOps Unicorns 2019
Anton Babenko
 
Resource Aware Scheduling in Apache Storm
DataWorks Summit/Hadoop Summit
 
Real-time Big Data Processing with Storm
viirya
 
Storm: Distributed and fault tolerant realtime computation
Ferran GalĂ­ Reniu
 
Apache Storm
Nguyen Quang
 

Viewers also liked (8)

PDF
Dapper & Dapper.SimpleCRUD
Blank Chen
 
PPTX
Location based AR & how it works
Duy Do Phan
 
PPT
BlackBerry Basic
Duy Do Phan
 
PPT
Cryptography Fundamentals
Duy Do Phan
 
PPTX
Twitter Bootstrap Presentation
Duy Do Phan
 
PPT
WCF
Duy Do Phan
 
PDF
專業前端 都如何管理 CSS
Chih-cheng Wang
 
PPT
PCI DSS
Duy Do Phan
 
Dapper & Dapper.SimpleCRUD
Blank Chen
 
Location based AR & how it works
Duy Do Phan
 
BlackBerry Basic
Duy Do Phan
 
Cryptography Fundamentals
Duy Do Phan
 
Twitter Bootstrap Presentation
Duy Do Phan
 
專業前端 都如何管理 CSS
Chih-cheng Wang
 
PCI DSS
Duy Do Phan
 
Ad

Similar to refORM: Death to ORMs in .NET (20)

PPTX
Sinfonier: How I turned my grandmother into a data analyst - Fran J. Gomez - ...
Codemotion
 
ODP
Jared Whitlock Open Source In The Enterprise Plone @ Novell
Vincenzo Barone
 
PPTX
Dapper: the microORM that will change your life
Davide Mauri
 
PPTX
Domain oriented development
rajmundr
 
PPTX
Robotics, Search and AI with Solr, MyRobotLab, and Deeplearning4j
Kevin Watters
 
PPTX
The Intersection of Robotics, Search and AI with Solr, MyRobotLab, and Deep L...
Lucidworks
 
PDF
Django in enterprise world
Simone Federici
 
PDF
What Web Framework To Use?
Kasra Khosravi
 
PPT
What does OOP stand for?
Colin Riley
 
PDF
Delphi ORM SOA MVC SQL NoSQL JSON REST mORMot
Arnaud Bouchez
 
PPT
Intro to openFrameworks
Kyle McDonald
 
PDF
10 Ways To Improve Your Code( Neal Ford)
guestebde
 
PDF
Rails in the Large - Neal Ford
Kmanthei
 
PDF
10 Ways To Improve Your Code
ConSanFrancisco123
 
PPTX
openQA Hoverboard - Open-source Question Answering Framework
Edgard Marx
 
PPT
UnConference for Georgia Southern Computer Science March 31, 2015
Christopher Curtin
 
PDF
Pharo Status
Jannik Laval
 
PDF
Super Sizing Youtube with Python
didip
 
PDF
Os Solomon
oscon2007
 
Sinfonier: How I turned my grandmother into a data analyst - Fran J. Gomez - ...
Codemotion
 
Jared Whitlock Open Source In The Enterprise Plone @ Novell
Vincenzo Barone
 
Dapper: the microORM that will change your life
Davide Mauri
 
Domain oriented development
rajmundr
 
Robotics, Search and AI with Solr, MyRobotLab, and Deeplearning4j
Kevin Watters
 
The Intersection of Robotics, Search and AI with Solr, MyRobotLab, and Deep L...
Lucidworks
 
Django in enterprise world
Simone Federici
 
What Web Framework To Use?
Kasra Khosravi
 
What does OOP stand for?
Colin Riley
 
Delphi ORM SOA MVC SQL NoSQL JSON REST mORMot
Arnaud Bouchez
 
Intro to openFrameworks
Kyle McDonald
 
10 Ways To Improve Your Code( Neal Ford)
guestebde
 
Rails in the Large - Neal Ford
Kmanthei
 
10 Ways To Improve Your Code
ConSanFrancisco123
 
openQA Hoverboard - Open-source Question Answering Framework
Edgard Marx
 
UnConference for Georgia Southern Computer Science March 31, 2015
Christopher Curtin
 
Pharo Status
Jannik Laval
 
Super Sizing Youtube with Python
didip
 
Os Solomon
oscon2007
 
Ad

Recently uploaded (20)

PDF
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
PDF
State-Dependent Conformal Perception Bounds for Neuro-Symbolic Verification
Ivan Ruchkin
 
PDF
The Future of Artificial Intelligence (AI)
Mukul
 
PDF
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
PDF
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
PPTX
Agile Chennai 18-19 July 2025 | Workshop - Enhancing Agile Collaboration with...
AgileNetwork
 
PPTX
The Future of AI & Machine Learning.pptx
pritsen4700
 
PPTX
Farrell_Programming Logic and Design slides_10e_ch02_PowerPoint.pptx
bashnahara11
 
PDF
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
PPTX
Simple and concise overview about Quantum computing..pptx
mughal641
 
PDF
NewMind AI Weekly Chronicles – July’25, Week III
NewMind AI
 
PDF
Generative AI vs Predictive AI-The Ultimate Comparison Guide
Lily Clark
 
PPTX
AVL ( audio, visuals or led ), technology.
Rajeshwri Panchal
 
PPTX
Agile Chennai 18-19 July 2025 Ideathon | AI Powered Microfinance Literacy Gui...
AgileNetwork
 
PDF
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
PDF
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
PDF
RAT Builders - How to Catch Them All [DeepSec 2024]
malmoeb
 
PDF
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
PDF
TrustArc Webinar - Navigating Data Privacy in LATAM: Laws, Trends, and Compli...
TrustArc
 
PPTX
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
State-Dependent Conformal Perception Bounds for Neuro-Symbolic Verification
Ivan Ruchkin
 
The Future of Artificial Intelligence (AI)
Mukul
 
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
Agile Chennai 18-19 July 2025 | Workshop - Enhancing Agile Collaboration with...
AgileNetwork
 
The Future of AI & Machine Learning.pptx
pritsen4700
 
Farrell_Programming Logic and Design slides_10e_ch02_PowerPoint.pptx
bashnahara11
 
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
Simple and concise overview about Quantum computing..pptx
mughal641
 
NewMind AI Weekly Chronicles – July’25, Week III
NewMind AI
 
Generative AI vs Predictive AI-The Ultimate Comparison Guide
Lily Clark
 
AVL ( audio, visuals or led ), technology.
Rajeshwri Panchal
 
Agile Chennai 18-19 July 2025 Ideathon | AI Powered Microfinance Literacy Gui...
AgileNetwork
 
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
RAT Builders - How to Catch Them All [DeepSec 2024]
malmoeb
 
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
TrustArc Webinar - Navigating Data Privacy in LATAM: Laws, Trends, and Compli...
TrustArc
 
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 

refORM: Death to ORMs in .NET

  • 1. R E F O R MDeath to ORMs in .NET
  • 2. “A Propos de Moi”@kouphaxhttp://github.com/kouphaxhttp://yobriefca.se
  • 3. DisclaimerThis presentation is full of opinion. My opinion. The fact is ORMs have been around for a long time and will be for a while yet. If things were as simple as I portray them in this presentation you wouldn’t be using them today. But you probably are.All I ask is that you never blindly use an ORM or any technology without prior brain thinking™
  • 4. On with the show…
  • 5. ORMs are for Life…So you’ve adopted an ORM, possiblyNHibernateMyBatisEntity FrameworkThe samples, blogs and demos promise you a better life, your “hello world” grade apps are easy and it adds another shiny buzzword to your CV (Resume Driven Development)You dive right in investing a heap of development cycles, things start out well…
  • 6. Suddenly and Without Warning…
  • 7. The Cracks Start To ShowLeaky AbstractionsBugger to debugForced to work for the ORM rather than the ORM working for youDBAs begin to call you namesCode generation and heavy use of model-polluting attributes bog you downCost of change is highOverreliance on ORMs make you dumb
  • 9. ORMs in .NET – More Like WTFsNHibernateHQL – WTF?MyBatisXML as a medium for SQL? – WTF?Entity FrameworkGreat demoware but the reality is more like WTF?
  • 10. Lets Be HonestHow many features of a heavyweight ORM do you really use regularly? 80%? 20%? 10%?How many of these features exist purely to support the abstraction?How difficult is the mapping between DB’s and objects really? Isn’t SQL the best DSL for working with data in a relational database?
  • 11. So why is this abstraction necessary?
  • 13. Historically speaking the alternatives were pretty slim. Most people would need to roll their own project specific data access layerMany ORMs grew out of that sort of thinking but from a community that thought XML was sexySome people are weirdThe world is a saner place these days. Reflection is fasterStatically typed languages have embraced dynamics, and,most people realise XML is a noisy medium for almost everything
  • 14. The Advent of Micro ORMs
  • 15. Level of AbstractionMicro ORMsHeavyweight ORMs
  • 17. DapperCreated by Sam Saffron of StackoverflowSingle file (available on Nuget)Set of extension methods to IDbConnectionSupports most .NET ADO providersSQL Server, Oracle, SQLite, MySQL, SQL CE Works on boths POCOs and dynamic objectsPretty close to the metalNo connection handlingNo helpers for INSERT, DELETE, UPDATE etc.Community extensions for CRUD operations.NET 3.5 support
  • 18. Demo
  • 20. Inserts, Updates & DeletesDapper
  • 21. Inserts, Updates & Deletes (CE)Dapper
  • 22. Dapper is very close to the metalVery little in the way of providing helpers for 1..N, N..N relationshipsDapper Community Extensions bridge some of the mental gap for people not used to SQLDapperAnd the rest…
  • 24. ORMLitePart of the ServiceStack technology suiteSet of CRUD extensions around System.Data.* namespaceCurrently supports SQLite and SQL ServerMaps data to and from concrete POCOsVia conventionVia attributes on the POCO – preferredVia raw SQLRelies heavily on POCO attributionSupports .NET 3.5
  • 25. Demo
  • 28. Inserts, Updates & DeletesORMLite
  • 29. ORMLite also allows you to create tables from entitiesEach model must have an Id property which must be its primary key.Integrates into the rest of the ServiceStack technology stackORMLiteAnd the rest…
  • 31. MassiveCreated by Rob ConreySingle file (available on Nuget)Makes extensive use of dynamicsNo mapping to POCOs for queriesPrefers to wrap tables rather than entitiesProvides a single point of configurationNo need for attributesOOTB Paging support.NET 4 Only
  • 32. Demo
  • 33. Creating the Dynamic ModelMassive
  • 35. Inserts, Updates & DeletesMassive
  • 36. ValidationsEventsAlso Github says…Asynchronous support for queriesAbility to reflect Schema MetadataAbility to generate a (DB) default rowFactory method for ad hoc/on the fly queriesMassiveAnd the rest…
  • 38. PetaPocoYet another single file (and on Nuget)Inspired by Massive and SubsonicSupports POCOs (and optional attributes)Paging and transaction support OOTBWorks with SQL Server, SQL Server CE, MySQL, PostgreSQL and Oracle..NET 3.5 upwards
  • 39. Demo
  • 42. Inserts, Updates & DeletesPetaPoco
  • 43. Out of the box support for 1..N, N..N fetching of objectsSlightly awkward approachRelationExtensions project abstracts this awkwardness for 1..N, N..1 queriesProvides a set of T4 Templates for generating POCOs from DB schemaPetaPocoAnd the rest…
  • 45. Simple.DataSlightly different beast though it’s principles are firmly in the MicroORM camp.Data Access ComponentNot just for relational databasesNoSQL supportExtensible Adapter/Provider supportSupports a wide range of data storesSQL Server, SQL Server CE, Oracle, MySQL, SQLite, MongoDB.NET 4 onlyExtensive use of dynamics and meta-programming concepts.TryInvokeMember, Method name reflection
  • 46. Demo
  • 49. Inserts, Updates & DeletesSimple.Data
  • 50. Inclusion of Simple.Data here may seem like a bit of contradiction. After all it is a straight up abstraction.It makes the 95th centile of all CRUD tasks “simple”Ability to compose DAL from other lightweight frameworks for the other edge case tasksAdditive approach rather than upfront monolithic approachSimple.DataAnd the rest…

Editor's Notes

  • #2: The purpose of this presentation today is to try and show you that the typical ORMs and Data Mappers you probably use in your projects are not the only option. I’m going to touch on some of their common pain points and hopefully most of you will have experienced some of them in some shape or form. After that I’ll give you a fairly high level overview of many of the more lightweight appraoches which I’m hoping will speak for themselves in terms of ease of use and brevity.
  • #5: The Answer
  • #6: What are they?What exists out there?
  • #7: The Answer
  • #8: With ORMs you get certain things for free with certain sacrifices. Many of these sacrifices directly affect your DBAsYou’ve immediatley created a defensive DBA and that aint pretty
  • #9: Eventually you realise your ORM has let itself go and no amount of refactoring is going to change things
  • #10: I’ve had to
  • #12: The question
  • #13: The Answer
  • #15: The modern development landscape has created a melting pot of lightweight innovation and micro ORMs are becoming quite prominent. The name itself is often a bit of misnomer. I suppose they are closer to Data Mappers than true ORMs but it’s a catchy name so
  • #17: The modern development landscape has created a melting pot of lightweight innovation and micro ORMs are becoming quite prominent. The name itself is often a bit of misnomer. I suppose they are closer to Data Mappers than true ORMs but it’s a catchy name so
  • #19: The modern development landscape has created a melting pot of lightweight innovation and micro ORMs are becoming quite prominent. The name itself is often a bit of misnomer. I suppose they are closer to Data Mappers than true ORMs but it’s a catchy name so
  • #24: The modern development landscape has created a melting pot of lightweight innovation and micro ORMs are becoming quite prominent. The name itself is often a bit of misnomer. I suppose they are closer to Data Mappers than true ORMs but it’s a catchy name so
  • #25: Attributes are fine(ish)
  • #26: The modern development landscape has created a melting pot of lightweight innovation and micro ORMs are becoming quite prominent. The name itself is often a bit of misnomer. I suppose they are closer to Data Mappers than true ORMs but it’s a catchy name so
  • #31: The modern development landscape has created a melting pot of lightweight innovation and micro ORMs are becoming quite prominent. The name itself is often a bit of misnomer. I suppose they are closer to Data Mappers than true ORMs but it’s a catchy name so
  • #33: The modern development landscape has created a melting pot of lightweight innovation and micro ORMs are becoming quite prominent. The name itself is often a bit of misnomer. I suppose they are closer to Data Mappers than true ORMs but it’s a catchy name so
  • #34: You can also do things like set the table name
  • #35: You can also do things like set the table name
  • #38: The modern development landscape has created a melting pot of lightweight innovation and micro ORMs are becoming quite prominent. The name itself is often a bit of misnomer. I suppose they are closer to Data Mappers than true ORMs but it’s a catchy name so
  • #40: The modern development landscape has created a melting pot of lightweight innovation and micro ORMs are becoming quite prominent. The name itself is often a bit of misnomer. I suppose they are closer to Data Mappers than true ORMs but it’s a catchy name so
  • #41: You can also do things like set the table name
  • #42: You can also do things like set the table name
  • #45: The modern development landscape has created a melting pot of lightweight innovation and micro ORMs are becoming quite prominent. The name itself is often a bit of misnomer. I suppose they are closer to Data Mappers than true ORMs but it’s a catchy name so
  • #47: The modern development landscape has created a melting pot of lightweight innovation and micro ORMs are becoming quite prominent. The name itself is often a bit of misnomer. I suppose they are closer to Data Mappers than true ORMs but it’s a catchy name so
  • #48: You can also do things like set the table name
  • #49: You can also do things like set the table name
  • #51: But a last it isn’t a swathe of mandatory configuration. Convention based.But it’s still very lightweight in comparison to the likes And the philosophy rests firmly in the MicroORM worldMicroORMs are more composable due to their sze and complexity