Please mention the difference between (big) ORM and micro ORM. What are the advantages of micro ORM over big ORM. For eg. the difference between entity framework ORM and dapper micro ORM.
Asked
Active
Viewed 3,884 times
16
-
1This is bit different but may help: https://stackoverflow.com/a/43590624/5779732. This is about ADO.NET vs Dapper: https://stackoverflow.com/a/47796179/5779732 – Amit Joshi Jan 17 '18 at 08:12
1 Answers
15
They are simply different tools. The key goal of micro-ORMs is to remove a lot of layers that an awful lot of data access code doesn't need - basically providing a minimal API surface and trying to balance that by offering the performance benefits that can come from simplicity. For example, things that you would expect to find in an ORM but might not be available in a micro-ORM include (depending on the specific tool being used, and the additional extension libraries being brought on):
- lazy loading of child members (perhaps via polymorphic runtime type generation, perhaps via code-gen)
- identity tracking
- change tracking
- a rich complex mapping system that supports arbitrary data models on multiple backend databases
- complex query generation from complex LINQ expression trees or some other DSL
- a unit-of-work API - essentially a
SubmitChanges()
method that figures out and applies a batch of related changes
Note that they aren't mutually exclusive: you can use both approaches in the same code-base, depending on what you need in different places.

Marc Gravell
- 1,026,079
- 266
- 2,566
- 2,900
-
But even with a micro-ORM you do have unit of work implemented by the db transaction. It's still an API even if it's ado.net. – MikeSW Jan 20 '18 at 13:58
-
@MikeSW what I mean is: a unit of work *automatically* provided by some kind of change tracking with an "all or nothing" commit; in a micro-ORM, yes you can do all of that via a db transaction: *but you need to do it yourself* – Marc Gravell Jan 20 '18 at 19:48