Hi, I am trying to convert the result of a DbContext to a DataTable . I have a class ie ClientTemplateModel that inherits DbContext . In this class, I have one DbSet object ie public virtual DbSet<imagecomment> ImageComments { get; set; } public virtual DbSet<imagecomment> ImageComments { get; set; } public virtual DbSet<imagecomment> ImageComments { get; set; } . I am using the Code first entity framework .
Here is my request.
using (ClientTemplateModel context = new ClientTemplateModel(connectionString)) { var result = context.ImageComments.Where(p => p.Dcn == dcn).OrderByDescending(p => p.CommentsDateTime); }
Here I want to convert result to DataTable . How can i convert this?
c # linq-to-sql datatable entity-framework dbcontext
Ajay punekar
source share