public static DbTransactionContext GetLoggedDbTransaction(DbTransaction transaction, int connectionId)
 {
     var context = new DbTransactionContext
     {
         IsAsync = false,
         IsCanceled = false,
         Exception = null,
         ObjectContextId = SessionIdLoggingContext.SessionId.GetUniqueId(),
         ObjectContextName = SessionId,
         ConnectionId = connectionId,
         TransactionId = UniqueIdExtensions<DbTransaction>.GetUniqueId(transaction).ToInt()
     };
     return context;
 }
Exemplo n.º 2
0
        public void LogTransaction(DbTransaction transaction,
                                   DbTransactionContext interceptionTransactionContext,
                                   CommandTransactionType type)
        {
            var commandTransaction = new CommandTransaction
            {
                IsAsync         = interceptionTransactionContext.IsAsync,
                TransactionType = type,
                IsCanceled      = interceptionTransactionContext.IsCanceled,
                Exception       = interceptionTransactionContext.Exception != null ? interceptionTransactionContext.Exception.Message : "",
                StackTrace      = new CallingMethod {
                    AssembliesToExclude = AssembliesToExclude
                }.GetCallingMethodInfo()
            };

            setBaseInfo(interceptionTransactionContext, commandTransaction);
            commandTransaction.TransactionId = UniqueIdExtensions <DbTransaction> .GetUniqueId(transaction).ToInt();

            _baseInfoQueue.Enqueue(commandTransaction);
        }
Exemplo n.º 3
0
 public void TransactionRolledBack(DbTransaction transaction, DbTransactionContext transactionContext)
 {
     LogTransaction(transaction, transactionContext, CommandTransactionType.RolledBack);
 }
Exemplo n.º 4
0
 public void TransactionDisposing(DbTransaction transaction, DbTransactionContext transactionContext)
 {
     LogTransaction(transaction, transactionContext, CommandTransactionType.Disposed);
 }
Exemplo n.º 5
0
 public void TransactionCommitted(DbTransaction transaction, DbTransactionContext transactionContext)
 {
     LogTransaction(transaction, transactionContext, CommandTransactionType.Committed);
 }