What major database projects are not suitable for use with NHIbernate?

NHibernate is excellent. However, I believe that its use should be limited (cannot be the answer to all questions), and in some cases it is better to use a different approach. The definition of "better" is also useful in this case.

So, I wonder when you do not choose NHibernate and prefer a different (what?) DB-level architecture?

EDIT: well, of course, I am asking about cases where we are talking about a large relational db that it clearly cannot solve problems for non-relational / sql dbs

+4
source share
3 answers

The main goal of NHibernate is the object-relational mapper - it largely eliminates the impedance mismatch between the object-oriented language and the relational database. Thus, a simple NHibernate answer is probably not appropriate unless impedance mismatch is a big enough problem to justify additional levels of abstraction, complexity, and potential performance degradation.

Looking at it from both ends, it is probably not suitable for applications where:

  • the object / data model is simple and there is no significant cost arising from the mismatch of objects / relations.
  • coding close to the database is important for performance, architectural or repair considerations.
  • the application has a unidirectional data stream (i.e. basically it is a recording device or data reader).
+4
source

NHibernate only works with relational databases. If you come across a NoSQL solution (e.g. RavenDB / MongoDB / etc) at your back-end, you will not be able to use NHibernate.

However, I use NHibernate for every project where this does not apply. Once you have overcome this initial learning curve associated with it, there is no reason not to use it, with the possible exception of @degorolls in scenarios where your application is mainly the author of the data. You benefit too much from using NHibernate to not use it even in simple applications where you have a user interface directly above the data warehouse.

+1
source

NHibernate is not the best choice when you need to process a huge amount of data, for example, when you perform synchronization or replication tasks. It will be very slow. In this case, it is better to use some SQL Server integration services.

Also, if you need to perform really complex queries, then the query API can stand in your way. QueryOver is great, but when you don't need to create alliances and complex subqueries. LINQ is not mature enough to solve all the SQL related stuff.

0
source

All Articles