Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between ORM and micro ORM?

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.

like image 792
Brillia Avatar asked Jan 16 '18 10:01

Brillia


People also ask

What is the difference between micro and fully featured ORM?

When talking about full-featured ORM, it's usually Entity Framework or NHibernate. Both work well and are easy to use. You probably already know what is the Micro ORM, but if not: Micro ORM is a lightweight ORM, usually limited in features, but performing faster than full-featured ORM.

Why Dapper is micro ORM?

Dapper is an example of Micro ORM, in fact, it is called the King of Micro ORM because of its speed and ease of work. First, it creates an IDbConnection object and allows us to write queries to perform CRUD operations on the database.

What is ORM and its types?

What Is an Object-Relational Mapping (ORM)? Object-relational mapping refers to synchronization between two different representations of data. From one side, there is a relational database, where the data is represented in terms of tuples, grouped into relations, while in application we manipulate objects.

Is Dapper a micro ORM?

This site is for developers who want to learn how to use Dapper - the micro ORM produced by the people behind Stack Overflow.


1 Answers

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.

like image 149
Marc Gravell Avatar answered Sep 29 '22 21:09

Marc Gravell