I'm building big web application that should communicate with the database very often. I'm wondering what library should I use for communication NHibernate or Entity Framework 6?
Here is my application specs:
LazyLoad
?UserStore
.Important things:
EF Core can use a ROWVERSION/TIMESTAMP column on SQL Server, or any of a list of columns, when updating a record. NHibernate offers richer capabilities, besides SQL Server ROWVERSION/TIMESTAMP, it can also use database native mechanisms such as Oracle's ORA_ROWSCN, but also timestamp or version columns.
NHibernate is still faster than ADO and Dapper for everything except the select.
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.
The standard ORM API in Java it's called JPA, and is part of the Java EE specification. Another alternative would be to use Hibernate.
As someone who is using NHibernate for several years I might not be the right person to help you choose between EF or NHibernate but here are some general pieces of advice that I've learned these years:
-Be in control : I mean choose an ORM that let you control every aspect of its functionality.Fortunately for us , NHibernate is one of them. You can call SPs and other Database objects and map their result to your objects.You can write interceptors to intercept NHibernate functionality and so on.
-Avoid general ORM issues from the start:one of them (which has a big impact on performance) is SELECT N+1.
-Use specific profiler to see how your ORM is working: I think this is really important for us to be able to see how the ORM is working and what queries are actually running in the back.
-Use cache whenever possible: I don't know about EF but Nhibernate has a second level cache mechanism that you can use to cache ferequently read and static data in memory to gain a better performance
-Have a plan for load testing and stress testing your application: No matter which ORM you choose , there will be times that you should increase the performance of your application.I think the best way to see how an application is working on a large scale is to somehow simulate it and try to tweak it so that it works in its best condition.
-Have a Plan B : ORMs are designed to help us to solve the dilemma of storing data in tables and using them as objects in our application.Thus they are doing something extra for us and they tend to be slower than using data in tabular format.So there are times that it would be better to use a plain tabular format in our application instead of converting it to objects (Take showing a list of information for instance)
P.S. This might be off topic but have you consider using a NoSql database instead of a relational one ?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With