private static void CommitUpdated(SqlDatabaseContext sqlDatabaseContext, IObjectsByIdCache cache, HashSet <DatabaseTransactionContextAcquisition> acquisitions, TransactionContext transactionContext) { var acquisition = transactionContext.AcquirePersistenceTransactionContext(sqlDatabaseContext); acquisitions.Add(acquisition); acquisition.SqlDatabaseCommandsContext.Update(cache.Type, cache.GetObjectsById()); acquisition.SqlDatabaseCommandsContext.Update(cache.Type, cache.GetObjectsByPredicate()); }
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; var key = new TypeAndTransactionalCommandsContext(cache.Type, persistenceTransactionContext); var currentInsertResults = persistenceTransactionContext.Insert(cache.Type, cache.GetNewObjects()); if (currentInsertResults.ToRetry.Count > 0) { insertResultsByType[key] = currentInsertResults; } if (currentInsertResults.ToFixUp.Count > 0) { fixups[key] = currentInsertResults.ToFixUp; } }
private static void CommitUpdated(SqlTransactionalCommandsContext commandsContext, IObjectsByIdCache cache) { commandsContext.Update(cache.Type, cache.GetObjectsById()); commandsContext.Update(cache.Type, cache.GetObjectsByPredicate()); }
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; } }
private static void CommitDeleted(SqlTransactionalCommandsContext commandsContext, IObjectsByIdCache cache) { commandsContext.Delete(cache.Type, cache.GetDeletedObjects()); }