2014/08/22

How to bind MVC model to different table ?

public class ApplicationDBContext : DbContext
{
public DbSet<ProductsModel> Products { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Entity<ProductsModel>().ToTable("Products");
// otherwise EF assumes the table is called "ProductsModel"
}
}
view raw gistfile1.cs hosted with ❤ by GitHub

No comments:

Post a Comment