Beispiel #1
0
        private static void CommitNewPhase1(SqlDatabaseContext sqlDatabaseContext, HashSet <DatabaseTransactionContextAcquisition> acquisitions, IObjectsByIdCache cache, TransactionContext transactionContext, Dictionary <TypeAndTransactionalCommandsContext, InsertResults> insertResultsByType, Dictionary <TypeAndTransactionalCommandsContext, IReadOnlyList <DataAccessObject> > fixups)
        {
            var acquisition = transactionContext.AcquirePersistenceTransactionContext(sqlDatabaseContext);

            acquisitions.Add(acquisition);

            var persistenceTransactionContext = acquisition.SqlDatabaseCommandsContext;

            foreach (var j in cache.GetNewObjects())
            {
                var key = new TypeAndTransactionalCommandsContext(j.Key, persistenceTransactionContext);

                var currentInsertResults = persistenceTransactionContext.Insert(j.Key, j.Value.Values);

                if (currentInsertResults.ToRetry.Count > 0)
                {
                    insertResultsByType[key] = currentInsertResults;
                }

                if (currentInsertResults.ToFixUp.Count > 0)
                {
                    fixups[key] = currentInsertResults.ToFixUp;
                }
            }
        }
        private static void CommitNewPhase1(SqlTransactionalCommandsContext commandsContext, IObjectsByIdCache cache, Dictionary <TypeAndTransactionalCommandsContext, InsertResults> insertResultsByType, Dictionary <TypeAndTransactionalCommandsContext, IReadOnlyList <DataAccessObject> > fixups)
        {
            var key = new TypeAndTransactionalCommandsContext(cache.Type, commandsContext);

            var currentInsertResults = commandsContext.Insert(cache.Type, cache.GetNewObjects());

            if (currentInsertResults.ToRetry.Count > 0)
            {
                insertResultsByType[key] = currentInsertResults;
            }

            if (currentInsertResults.ToFixUp.Count > 0)
            {
                fixups[key] = currentInsertResults.ToFixUp;
            }
        }