简体   繁体   中英

How to convert datatable into Entity Framework classes?

I'd like to run a stored procedure (for performance issues I preferred stored procedures) and at the end I'd like to have module like the one below.

Do you also think in order to achieve this stored procedure is a better solution?

在此处输入图片说明

And, if I use a stored procedure, I'd like to preserve my EF structure. So, I probably need to convert the DataTable from the stored procedure into the EF class structure.

Does .NET have some sort of method that handles this conversion or do I have to build up something myself?

And once again, do you really think to do this with a stored procedure is better approach than getting the data over EF , and develop some algorithm on ASP.NET C# to make it look like the one on the picture I uploaded? And if you could also provide WHY , that would be really awesome.

Thank you very much

Why do you want to convert a DataTable to an EF entity? You don't have to use a DataTable to get the results from a stored procedure, you can retrieve EF objects directly from stored procedures

Have a look at this article

Stored Procedures in the Entity Framework

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM