Search This Blog

Thursday, July 21, 2016

Difference between DBContext and DBSet

 DbContext corresponds to your database (or a collection of tables and views in your database) whereas a DbSet corresponds to a table or view in your database. So it makes perfect sense that you will get a combination of both!


public class MyAppContext : DbContext
{
    public MyAppContext () : ;

    public DbSet<Table1> Table1 { get; set; }
    public DbSet<Table2> Table2 { get; set; }
    public DbSet<Table3> Table3 { get; set; }
    public DbSet<Table4> Table4 { get; set; }
    public DbSet<Table5> Table5 { get; set; }
}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.