Click here to Skip to main content
15,886,565 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I have one query regarding ORM technologies.

I have a task here where I need to develop a reporting an analysis tool which will show reports and charts to the user based on the data retrieved from the database.

The business logic of data retrieval is written in the Stored procedures on database, the application will run the SPs, retrieve data from them and display them on report or in the form of charts.

The client is insisting on using an ORM technology, Entity Framework preferably.
But I am in confusion about how feasible it is to use ORM technology just to retrieve data coz it will be a good effort to create mappings and other things to make it working fine. and after all these efforts we are not using the most important feature of ORM - Object state tracking and persistence management. Also data retrieval with ORM will be slow as there will be overhead of creating of objects out of the data retrieved from database.

I would prefer to use conventional ADO.NET and collect data in dataset of datareader and pass it to the report of chart to be displayed.

Still, I am looking for experts comments on it so that I can be firm on my opinion and have my thoughts clearly represented to the client.

Thanks and regards,
Chetan Ranpariya
Posted
Updated 30-Apr-18 17:53pm

When dealing with this sort of situation I usully compare the value of developer time to machine performance. If you are a competent database developer/administrator you can almost alway significantly beat the performance that you get from the ORM. Note that this has very little to do with the sql code compilation and a lot to do with statistics and indexes. Also small changes in sql can have more of an effect than you would think reasonable.

Put simply ORM is good and you probably should use it as the first draft of your app.

Performance can then be improved through appropriate stored procedures ans database modifications later.

Ken
 
Share this answer
 
For reporting purpose, it would obviously be a good idea NOT TO USE ORM (That is, USE Stored Procedure and DataReader), simply because it would allow you to generate the reports faster specially if your database has a tendency to grow larger (And hence the report SQL execution would have a tendency to become slower). It would also allow you to manage reporting functionality later in a simpler way.

You can request your client to let you know the reason why they want to insist an ORM. May be their data volume is of moderate size, or, client of your client may insists on using an ORM (Who knows?). Knowing the reason would help you deciding your strategy to convince your client regarding this matter.
 
Share this answer
 
v2
Comments
Pete O'Hanlon 20-Dec-10 6:39am    
Hmmm. Not quite accurate I'm afraid. A well crafted ORM request can be as efficient as a hand-crafted one. The trick is in knowing how to get the best performance out of the ORM. I suspect you are referring to the idea that a stored procedure execution plan is compiled and a direct query isn't. If the OP is developing in SQL Server, then this isn't always the case - direct queries can end up being compiled as well.
Hi Al-Farooque,

Thank you for posting the answer.

But I am confused with the very first sentence of your answer.

For reporting purpose, it would obviously be a good idea NOT TO USE ORM (this means I should not use ORM for reporting purpose), (but on the contrary you say that) simply because it would allow you to generate the reports faster specially if your database has a tendency to grow larger (And hence the report SQL execution would have a tendency to become slower)(Means if my data base has tendency to grow larger, it is good to use ORM for reporting purpose).

Anyways, for me the database is having millions of records to pull out from to generate reports. And as you suggest I will ask them their actual requirement and also keep my point in front of them.

Thanks again...

Thanks and regards,
Chetan Ranpariya
 
Share this answer
 
Comments
Al-Farooque Shubho 20-Dec-10 6:21am    
I understood that my reply was a little bit confusing. I've modified the reply a bit so that, it is more clear.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900