コード例 #1
0
ファイル: ValidatorBase.cs プロジェクト: renezweifel/Deblazer
        public IReadOnlyDictionary <DbEntity, IReadOnlyList <ValidationError> > ValidateForDelete(IReadOnlyList <DbEntity> entities)
        {
            IDbWrite writeDb = null;

            foreach (var entity in entities)
            {
                var db = entity?.DbInternal;
                if (db == null)
                {
                    throw new InvalidOperationException("The Db instance is NULL which is not allowed. You are probably trying to delete an Entity which is not yet in the DB and therefore can not be deleted.");
                }

                var currentWriteDb = db as IDbWrite;
                if (currentWriteDb == null)
                {
                    throw new InvalidOperationException("You are trying to validate for delete with a Db which does not support writes. You propably did not intend this.");
                }

                if (writeDb != null && currentWriteDb != writeDb)
                {
                    throw new InvalidOperationException("ValidateForDelete was called with entities from different Dbs. This is not valid because they are going to be submitted with the same Db.");
                }
                writeDb = writeDb ?? currentWriteDb;
            }

            return(ValidateForDeleteGeneric(writeDb, entities.Where(e => e is T).Select(e => (T)e).ToList()));
        }
コード例 #2
0
 public IReadOnlyList <IAggregateUpdate> GetAggregateUpdates(IDbWrite db)
 {
     return(Array.Empty <IAggregateUpdate>());
 }
コード例 #3
0
ファイル: Editor.cs プロジェクト: oveldman/msprimo
 public Editor(PrimoContext newContext)
 {
     _dbWrite = new DbWrite(newContext);
     _dbRead  = new DbRead(newContext);
 }
コード例 #4
0
 internal IEnumerable <TElement> SelectBy(IDbWrite db, string column, object value)
 {
     return(db.Load <TElement>("SELECT " + string.Format(ColumnsString, FullTableName) + " FROM " + FullTableName + " WHERE " + column + " = @0", value));
 }
コード例 #5
0
ファイル: ValidatorBase.cs プロジェクト: renezweifel/Deblazer
 protected abstract IReadOnlyDictionary <DbEntity, IReadOnlyList <ValidationError> > ValidateForDeleteGeneric(IDbWrite writeDb, IReadOnlyList <T> entities);