Entity Framework - is it suitable for an enterprise application?

I have a web application with:

  • 1 terabyte DB
  • 200 + tables
  • At least 50 tables with 1 million records each
  • 10+ developers
  • 1000 concurrent users

This project is currently using Ad-Hoc Sql, which is created by the custom ORM solution. Instead of supporting custom ORMs (which lack many advanced features), I'm going to switch to the Entity Framework.

I used EF 4.1 (Code-First) for a smaller project, and it worked pretty well, but does it scale for a much larger project higher?

+6
source share
3 answers

I (highly) agree with the thoughts of marvelTracker (and Ayende).

Here is another information:

Key strategies

There is a known cost when using GUIDs as primary keys. It was described by Jimmy Nilsson, and it was publicly available at http://www.informit.com/articles/article.aspx?p=25862 . NHibernate supports the GUIDCOMB primary key strategy. However, to achieve this, EntityFramework is a bit complicated and additional steps are required.

Transfers

EntityFramework does not support enumerations natively. Until June, CTP, which adds support for Enums http://blogs.msdn.com/b/adonet/archive/2011/06/30/walkthrough-enums-june-ctp.aspx , the only way to match enums is to use workarounds. See: How to work with Enums in the Entity Framework?

Inquiries

NHibernate offers many ways to request data:

  • LINQ (using re-motion re-linq provider, https://www.re-motion.org/web/ )
  • Named Queries Encapsulated in Query Objects
  • ICriteria / QueryOver for queries where criteria are not known in advance
  • Using QueryOver forecasts and aggregates (in cases we only need specific properties of the object. In other cases, we may need the results of an aggregate function, such as average or quantity):
  • PagedQueries: try to avoid user suppression and increase application performance; large result sets are usually divided into smaller pages of results.
  • MultiQueries that combine multiple ICriteria and QueryOver queries into one roundtrip database
  • Individual requests that are request objects in parts of the application without access to the NHibernate session. These objects are then executed elsewhere with the session. This is good because we can avoid complex repositories with many methods.

ISessions QueryOver:

// Query that depends on a session: premises = session.QueryOver<Premise>().List(); 

Private QueryOver:

 // Full reusable query! var query = QueryOver.Of<Premise>(); // Then later, in some other part of ther application: premises = query.GetExecutableQueryOver(session).List(); // Could pass IStateleSession too. 

Open source

NHibernate has many contributing projects available at http://sourceforge.net/projects/nhcontrib/

This project provides a number of very useful extensions for NHibernate (among others):

  • Cache Providers (for L2 Cache)
  • Dependency Injection for Objects without a Default Constructor
  • Full Text Search (Lucene.NET Integration)
  • Spatial Support (NetTopologySuite Integration)

Support

EntityFramework comes with Microsoft support. NHibernate has an active community:

Also, see: http://www.infoq.com/news/2010/01/Comparing-NHibernate-EF-4

+8
source

NHibernate is the best choice for you because it has good support for complex query, second-level caching and great support for optimizations. I think EF gets there. If you are dealing with Legacy systems, NHibernate is the best approach.

http://ayende.com/blog/4351/nhibernate-vs-entity-framework-4-0

+4
source

An interesting term comes up. This is useful? Yes, and you will find a number of nice features well suited for rapid application development. However, it is a somewhat half-baked technology, and it lacks many of the advanced features of its predecessor LINQ to SQL (even 3 years after its first release). Here are a few troubles:

  • Poor integrated LINQ support.
  • No Enum Property Types
  • Lack of SQL conversions (DateTime parsing, parse int, etc.) (although you can implement them through certain models)
  • Poor readability of SQL
  • Problems saving multiple ssdl / csdl / msl resources independent of shards (no problem with the first code)
  • Issues with starting multiple concurrent transactions in different ObjectContext objects
  • Problems with individual object scripts

However, Microsoft has put a lot of effort into this, and hopefully it will continue to improve over time. I personally would spend time implementing a well-abstract Repository / Unit of Work template so that your code does not know it at all with EF, and if necessary, you can switch to another LINQ to DB provider in the future.

Most modern ORMs will be a step forward from ad-hoc SQL.

+2
source

Source: https://habr.com/ru/post/894300/


All Articles