dbcontext - Entity Framework ExecuteSqlCommand return Object List -


Due to the unsupported view mapping of the table, I am most disappointed with the EF code. So I'm switching out with ExecuteSqlCommand to retrieve View Data Classes. But I can not understand how to do this? Any help maybe? Secure Override Zero OnModelCreating (DbModelbuilder Model Builder) {modelBuilder.Ignore & lt; M_box & gt; (); } Secure Override Zero Seed (Ebagacy Contact Reference) {context.Database.ExecuteSqlCommand (m_boxView.GetInitView), New Object [] {}); } Public static class m_boxView {public static string GetInitView () {return "Create m_box" + "as select agencyRef.Code AM module code," + "value scale," + "value. Advance" + "value "+" Left join agency reef "+" on (primecode = agency r.ccode) "+" where left (value code, 1) = 'C' "; }}

If you want to mapping a view to the organization, Must follow:

  • Map it as a table first (do not ignore such a m_box ) and EF to m_box Make the table.
  • In your seed method, you have to delete the created table and create a view with the same name.

Comments