RepoDB
RepoDB copied to clipboard
Bug: Before/AfterExecuteQuery and similar methods not being called.
Bug Description
ITrace interface contains a definition for Before and After callbacks for:
ExecuteNonQueryExecuteQueryExecuteQueryMultipleExecuteReaderExecuteScalar
But none of these callbacks are beign called.
Other methods have internally something like this:
// Before Execution
if (trace != null)
{
sessionId = Guid.NewGuid();
var cancellableTraceLog = new CancellableTraceLog(sessionId, context.CommandText, entity, null);
trace.BeforeInsert(cancellableTraceLog);
if (cancellableTraceLog.IsCancelled)
{
if (cancellableTraceLog.IsThrowException)
{
throw new CancelledExecutionException(context.CommandText);
}
return default(TResult);
}
context.CommandText = (cancellableTraceLog.Statement ?? context.CommandText);
entity = (TEntity)(cancellableTraceLog.Parameter ?? entity);
}
// After Execution
if (trace != null)
{
trace.AfterInsert(new TraceLog(sessionId, context.CommandText, entity, result,
DateTime.UtcNow.Subtract(beforeExecutionTime)));
}
But the implementations of those Execute* methods at RepoDB/RepoDb.Core/RepoDb/DbRepository.cs is lacking of that code.
Library Version: Github Master branch.
Hey, thank you for reporting this issue. We will cover this on the next release (minor/major).
Hi @mikependon, any alternative for this issue?
@Edwx - we missed this one on the last release, and we are planning to deliver a new one soon. Are you able to wait that? We are targetting the 2nd week of September.
The reason of the delay is because of this proposal (at issue #941). We are hopeful can be completed before our target date.