Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best ORM to use with C# 4.0 [closed]

what is the best way is to use a ORM like Nhibertate or Entity Framework or to do a customer ORM . I will use this ORM for a C# 4.0 project

like image 797
ma7moud Avatar asked Jul 06 '10 15:07

ma7moud


People also ask

What is the fastest ORM?

Often regarded as the fastest ORM, Dapper is consistently at or near the top of . NET ORM benchmarks.

Should I use an ORM C#?

So, do you need an ORM? If you have any more or less complex project and you work with a relational database, then yes, definitely. Big ORMs seem "bloated" not because they are bad tools, but rather because the underlying problem of object-relational mapping is hard.

Does C# have ORM?

Object-Relational Mapping or ORM is a technique for converting data between C# objects and relational databases. ORM converts data between two incompatible type systems (C# and MySQL), such that each model class becomes a table in our database and each instance a row of the table.


1 Answers

UPDATE 2016

Six years later things are VERY different. NHibernate is all but abandoned, other alternatives were abandoned (eg Subsonic), Entity Framework is perhaps the most common full-featured ORM, and people have been moving to micro ORMs like Dapper for years, to map from queries to objects with a minimum of overhead.

The application scenarios have also changed. Instead of loading and caching one big object graph at the expense of memory and performance, Web Services and REST APIs need to service a high number of smaller requests. This means that a full ORM's overhead is no longer acceptable.

This means that patterns and techniques like Active Record, transaction per request etc have become throughput and scalability killing anti-patterns

One of the most important features nowadays is asynchronous execution , to reduce thread and CPU waste due to waits. NHibernate never made this transition.

Original Answer

Define "best": Is it the most mature, the one with more documentation, bigger community, more mainstream?

NHibernate is more mature, feature rich, with a more advanced community and not likely to be discontinued when MS decides to break compatibility again. Entity Framework is more mainstream and is supported out-of-the-box. You will find more beginner books for EF, more advanced books for NH.

A good option would be to try one of the simpler ORMs like Subsonic and move to more advanced ORMs once you understand how ORMs work, what are the various pitfalls, what SELECT N+1 means [:P]

Just don't try to create your own ORM, there are several dozens out there already! Subsonic, Castle ActiveRecord, NH, EF (of course), LLBLGenPro...

like image 180
Panagiotis Kanavos Avatar answered Sep 29 '22 11:09

Panagiotis Kanavos