コード例 #1
0
ファイル: DbContextBase.cs プロジェクト: egulay/pikachu.core
        public void ApplyStateChanges()
        {
            foreach (var dbEntityEntry in ChangeTracker.Entries())
            {
                var entityState = dbEntityEntry.Entity as IObjectState;
                if (entityState == null)
                {
                    throw new InvalidCastException("All entites must implement the IObjectState interface, " +
                                                   "this interface must be implemented so each entites state can explicitely determined when updating graphs.");
                }

                dbEntityEntry.State = GenericHelpers.ConvertState(entityState.State);
            }
        }