public void LogConnection(DbConnection connection, DbConnectionContext interceptionConnectionContext, CommandConnectionType type) { var commandConnection = new CommandConnection { IsAsync = interceptionConnectionContext.IsAsync, Type = type, IsCanceled = interceptionConnectionContext.IsCanceled, ConnectionString = connection.ConnectionString, Exception = interceptionConnectionContext.Exception != null ? interceptionConnectionContext.Exception.Message : "", StackTrace = new CallingMethod { AssembliesToExclude = AssembliesToExclude }.GetCallingMethodInfo() }; setBaseInfo(interceptionConnectionContext, commandConnection); if (commandConnection.ConnectionId == null) { commandConnection.ConnectionId = UniqueIdExtensions <DbConnection> .GetUniqueId(connection).ToInt(); } _baseInfoQueue.Enqueue(commandConnection); }
public static DbConnectionContext GetLoggedDbConnection(DbConnection connection) { var context = new DbConnectionContext { IsAsync = false, IsCanceled = false, Exception = null, ConnectionString = connection.ConnectionString, ObjectContextId = SessionIdLoggingContext.SessionId.GetUniqueId(), ObjectContextName = SessionId, ConnectionId = UniqueIdExtensions<DbConnection>.GetUniqueId(connection).ToInt() }; return context; }
public static DbConnectionContext GetLoggedDbConnection(ProfiledDbTransaction interceptionContext, int connectionId) { var context = new DbConnectionContext { IsAsync = false, IsCanceled = false, Exception = null, ConnectionString = interceptionContext.Connection.ConnectionString, TransactionId = interceptionContext.InnerTransaction == null ? (int?)null : UniqueIdExtensions<DbTransaction>.GetUniqueId(interceptionContext.InnerTransaction).ToInt(), IsolationLevel = interceptionContext.IsolationLevel, ObjectContextId = SessionIdLoggingContext.SessionId.GetUniqueId(), ObjectContextName = SessionId, ConnectionId = connectionId }; return context; }
public void TransactionBegan(DbConnection connection, DbConnectionContext context) { var commandTransaction = new CommandTransaction { IsAsync = context.IsAsync, TransactionType = CommandTransactionType.Began, IsCanceled = context.IsCanceled, Exception = context.Exception != null ? context.Exception.Message : "", StackTrace = new CallingMethod { AssembliesToExclude = AssembliesToExclude }.GetCallingMethodInfo() }; setBaseInfo(context, commandTransaction); commandTransaction.TransactionId = context.TransactionId; commandTransaction.IsolationLevel = context.IsolationLevel; _baseInfoQueue.Enqueue(commandTransaction); }
public void ConnectionOpened(DbConnection connection, DbConnectionContext context) { LogConnection(connection, context, CommandConnectionType.Opened); }
public void ConnectionDisposing(DbConnection connection, DbConnectionContext context) { LogConnection(connection, context, CommandConnectionType.Disposed); }