Why are we able to use automatic properties with DBSet, but not with ObjectSet:
public class SomeContext : DbContext
{
public DbSet<Address> Addresses { get; set; }
...
}
Thank you
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
DbContext is using convention over configuration paradigm. It discovers entity sets based on DbSet properties defined on the DbContext derived class (or in general, it discovers your model based on your code). ObjectContext does not do any discovery and is not convention based. It just reads your model from csdl, ssdl and msl artifacts. As a result ObjectContext requires that the user tells exactly what needs to be exposed.