EF4 - ChangeObjectState is no longer accessible in RC
After migrated EF4 CTP5 to RC1, I notice the ObjectContext is no longer accessible through DbContext. It means I can't access ChangeObjectState method.
class DataContext : DbContext
{
public DataContext()
{
}
public DataContext(DbCompiledModel dbModel)
: base(dbModel)
{
}
public DbSet<MyClass> MyClasses { get; set; }
public void ChangeObjectState<T>(T entity, EntityState entityState)
{
// this is no longer working.. where is ObjectContext?
ObjectContext.ChangeObjectState(entity, entityState);
}
}
Has anyone have any idea how access that method in RC1?
开发者_JAVA百科Thanks.
You don't need to access ObjectContext
to change object state. Use this:
this.Entry<T>(entity).State = entityState;
精彩评论