How can I map the results of raw query to datatable using EntityFramework 6?

时间:2017-03-22 18:40:24

标签: entity-framework datatable

I have a need to run raw queries on a database. These tables do not have Model classes in my project to map the result onto.

So I want to be able to execute any select query using context.Database SqlQuery but instead of mapping it a model class, I want to be able to map it to a generic solution like datatable or List<Dictionary<string,string>>.

Is it possible to do such a thing in EntityFramework 6?

I know I can use SqlDataAdapter to execute raw query and map the data to a datatable. I am just looking for a way to do the something with Entity.

0 个答案:

没有答案