sql – To what extent 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 . To what extent is it worth using an ORM? Is there any tool that I can compare in terms of performance to 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 better performance: EF or NHibernate?

I know it all also depends on the structure of the bank and best practices, but in general for a very large system do I consider an ORM? Since the cost benefit of maintaining the system is much higher than not using it.

Answer:

I am in favor of a mixed approach

  • Make the most of ORM to improve readability and productivity . In C# or VB.Net it is possible to 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 further and look for information on the internet, and only then, go to SQL .

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

Which to choose?

I work 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 come down to a matter of custom, ie use the one that is more familiar .

    If I had to learn one of them, I would choose EntityFramework , it uses the most current technologies, and is evolving rapidly.

    And if you already know both, you would go with EntityFramework too, because it's 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 let you down nothing.

References

Scroll to Top