sql – How far is it not advisable to use an ORM?

Question:

I'm working on a very large system using .NET (ASP.NET MVC) the application requires a critical level of performance . How much is it worth using an ORM or not? Is there any tool that I can compare in terms of performance with ORM'S and pure SQL?

I know there is a performance difference between pure SQL and ORM, I don't know if it's Active Record's or ORM's in general are slower compared to pure SQL, if you consider using an ORM, which one probably has the best performance: EF or NHibernate?

I know it all depends on the structure of the bank and good practices as well, but overall for a very large system would I consider an ORM? Since the cost benefit in relation to system maintenance is much higher than not using it.

Answer:

I favor a mixed approach

  • Make the most of ORM to improve readability and productivity . In C# or VB.Net you can use LINQ, which is an extraordinary tool in terms of productivity. The simpler the better.

  • When you need to increase performance, or when the ORM doesn't offer the right tools for the job, study the chosen ORM more deeply and look for information on the internet, and only then, go to SQL .

    ORM's usually allow you to use a language similar to SQL, or else allow you to use SQL with specific formatting, which is a middle point.

Which one to choose?

Working with both, NHibernate has more features, is more flexible, and has many tools and extension libraries, however EntityFramework is simpler and easier to use, and the tools integrate with Visual Studio.

  • For a project that is born with LOW demand

    Choosing between EntityFramework and NHibernate in this case can be reduced to a matter of habit, ie, use the one you are most familiar with .

    If I have to learn one of them, I would choose EntityFramework , it uses the latest technologies, and it's evolving rapidly.

    And if you already know both, you would go from EntityFramework too, as it is simpler to work with, in addition to having integration with Visual Studio , which helps a lot in productivity.

  • For a project that is born with HIGH demand

    For a project that is going to be born with a large load of data/users/expectation (imagine a system for a company to manage thousands of employees), then I would still recommend NHibernate… it's a technology that certainly won't leave you wanting nothing.

References

Scroll to Top