Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Entity framework vs NHibernate - Performance

Tags:

I am looking to implement an ORM into our system. We currently have many tables with lots of horrible data and stored procedures. I've heard using an ORM can slow the system down. Does anyone know which ORM is better on speed and performance using Queries created in the C# code and mapping to stored procedures?

Thanks

EDIT:

The project will use existing tables that are large and contain a lot of data, it will also use existing stored procedures that carry out complex tasks in a SQL Server DB. The ORM must be able to carry out transactions and have high performance when running the existing stored procedures and querying the current tables. The project is web based and will use WCF web services with DDD. I can see that EF is a lot easier to use and has greater support but if NH the most suitable option?

like image 886
Funky Avatar asked Aug 01 '13 15:08

Funky


People also ask

Is NHibernate a framework?

NHibernate is a mature, open source object-relational mapper for the . NET framework. It's actively developed, fully featured and used in thousands of successful projects.

Which is faster Entity Framework or dapper?

Dapper is literally much faster than Entity Framework Core considering the fact that there are no bells and whistles in Dapper. It is a straight forward Micro ORM that has minimal features as well. It is always up to the developer to choose between these 2 Awesome Data Access Technologies.

Is Entity Framework core faster than Entity Framework?

The conclusions are obvious: in almost every test conducted by Chad, Entity Framework Core 3 is faster than Entity Framework 6 – exactly 2.25 to 4.15 times faster! So if performance is important to your application and it operates on large amounts of data, EF Core should be a natural choice.

Is hibernate similar to Entity Framework?

nHibernate supports all types of databases but Entity framework need additional connectors to support databases other than MSSQL. nHibernate can be extended in terms of data loading, SQL generation, custom column types, custom collections etc but entity framework has limited extension points.


1 Answers

check this artical Some Advantages of NH over EF

  1. NH has 10+ id generator strategies (IDENTITY, sequence, HiLo, manual, increment, several GUIDs, etc), EF only has manual or SQL Server's IDENTITY;
  2. NH has lazy property support (note: not entities, this is for string, XML, etc properties), EF doesn't;
  3. NH has second level cache support (and, believe me, enterprise developers are using it) and EF doesn't;
  4. NH has support for custom types, even complex, with "virtual" properties, which includes querying for these virtual properties, EF doesn't;
  5. NH has formula properties, which can be any SQL, EF doesn't;
  6. NH has automatic filters for entities and collections, EF doesn't;
  7. NH supports collections of primitive types (strings, integers, etc) as well as components (complex types without identity), EF doesn't;
  8. NH supports 6 kinds of collections (list, set, bag, map, array, id array), EF only supports one;
  9. NH includes a proxy generator that can be used to customize the generated proxies, EF doesn't allow that;
  10. NH has 3 mapping options (.HBM.XML, by code, by attributes) and EF only two (by attributes, by code);
  11. NH allows query and insertion batching (this is because EF only really supports IDENTITY keys), EF doesn't;
  12. NH has several optimistic control strategies (column on the db, including Oracle's ORA_ROWSCN, timestamp, integer version, all, dirty columns), EF only supports SQL Server' TIMESTAMP or all
like image 68
Muhammad Nasir Avatar answered Sep 24 '22 16:09

Muhammad Nasir