Export Model to DataTable

You can use ToDataTable extension method but you need to install MoreLinq first. To install MoreLINQ, run the following command in the Package Manager Console:

PM> Install-Package morelinq

Then add the following line to your using directives:

using MoreLinq;

And finally you can use ToDataTable extension method:

DataTable s = db.EMPs.ToDataTable();

Leave a Comment