Are there any differences when doing the following:
public class UsersContext : DbContext
{
public DbSet<User> Users { get; set; }
}
versus using the Set<T>
method of the context:
public class UsersContext : DbContext
{
}
var db = new UsersContext();
var users = db.Set<User>();
These effectively do the same thing, giving me a set of Users, but are there any big differences other than you are not exposing the set through a property?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…