public override bool RequiresTransactionForAuditEntities(SingleStatementQueryAction actionToStart) { // if we have entities of our own, we have to tell the caller that so it can create a transaction return(_toUpdate.Count > 0 && (actionToStart == SingleStatementQueryAction.ExistingEntityUpdate || actionToStart == SingleStatementQueryAction.NewEntityInsert)); }
/// <summary> /// Method which returns true if this auditor expects to have audit entities to persist and therefore needs a transaction. /// This method is called in the situation when there's no transaction going on though one should be started right before the single-statement action /// in the case if the auditor has entities to save afterwards. It's recommended to return true if the auditor might have audit entities /// to persist after an entity save/delete/direct update/direct delete of entities. Default: true /// </summary> /// <param name="actionToStart">The single statement action which is about to be started.</param> /// <returns> /// true if a transaction should be started prior to the action to perform (entity save/delete/direct update/direct delete of entities) /// false otherwise. /// </returns> /// <remarks>If false is returned and GetAuditEntitiesToSave returns 1 or more entities, a new transaction is started to save these audit entities /// which means that this transaction isn't re-tryable if this transaction might fail. /// /// In no entity-based audition (text file for example) where no transaction is required. This method should return false. This avoids the creation /// of unnecessary transactions.</remarks> public override bool RequiresTransactionForAuditEntities(SingleStatementQueryAction actionToStart) { return(false); }