Skip to content

Instantly share code, notes, and snippets.

@mikependon
Last active September 28, 2021 13:53
Show Gist options
  • Save mikependon/e681f562c78a6195e8429e4a039d08d8 to your computer and use it in GitHub Desktop.
Save mikependon/e681f562c78a6195e8429e4a039d08d8 to your computer and use it in GitHub Desktop.
TraceBase
using System;
namespace RepoDb
{
/// <summary>
/// A base class for tracing the existing operations.
/// </summary>
public class TraceBase : ITrace
{
#region ITrace
/// <summary>
/// A method that is being raised before the actual operation execution.
/// </summary>
/// <param name="log">The cancellable log object referenced by the execution.</param>
public virtual void BeforeExecution(CancellableTraceLog log) =>
GetType()
.GetMethod($"Before{log.Key}")?
.Invoke(this, new object[] { log });
/// <summary>
/// A method that is being raised after the actual operation execution.
/// </summary>
/// <param name="log">The log object referenced by the execution.</param>
public virtual void AfterExecution(TraceLog log) =>
GetType()
.GetMethod($"After{log.Key}")?
.Invoke(this, new object[] { log });
#endregion
#region Before
public virtual void BeforeAverage(CancellableTraceLog log)
{
throw new NotImplementedException();
}
public virtual void BeforeAverageAll(CancellableTraceLog log)
{
throw new NotImplementedException();
}
public virtual void BeforeBatchQuery(CancellableTraceLog log)
{
throw new NotImplementedException();
}
public virtual void BeforeCount(CancellableTraceLog log)
{
throw new NotImplementedException();
}
public virtual void BeforeCountAll(CancellableTraceLog log)
{
throw new NotImplementedException();
}
public virtual void BeforeDelete(CancellableTraceLog log)
{
throw new NotImplementedException();
}
public virtual void BeforeDeleteAll(CancellableTraceLog log)
{
throw new NotImplementedException();
}
public virtual void BeforeExecuteNonQuery(CancellableTraceLog log)
{
throw new NotImplementedException();
}
public virtual void BeforeExecuteQuery(CancellableTraceLog log)
{
throw new NotImplementedException();
}
public virtual void BeforeExecuteReader(CancellableTraceLog log)
{
throw new NotImplementedException();
}
public virtual void BeforeExecuteScalar(CancellableTraceLog log)
{
throw new NotImplementedException();
}
public virtual void BeforeExists(CancellableTraceLog log)
{
throw new NotImplementedException();
}
public virtual void BeforeInsert(CancellableTraceLog log)
{
throw new NotImplementedException();
}
public virtual void BeforeInsertAll(CancellableTraceLog log)
{
throw new NotImplementedException();
}
public virtual void BeforeMax(CancellableTraceLog log)
{
throw new NotImplementedException();
}
public virtual void BeforeMaxAll(CancellableTraceLog log)
{
throw new NotImplementedException();
}
public virtual void BeforeMerge(CancellableTraceLog log)
{
throw new NotImplementedException();
}
public virtual void BeforeMergeAll(CancellableTraceLog log)
{
throw new NotImplementedException();
}
public virtual void BeforeMin(CancellableTraceLog log)
{
throw new NotImplementedException();
}
public virtual void BeforeMinAll(CancellableTraceLog log)
{
throw new NotImplementedException();
}
public virtual void BeforeQuery(CancellableTraceLog log)
{
throw new NotImplementedException();
}
public virtual void BeforeQueryAll(CancellableTraceLog log)
{
throw new NotImplementedException();
}
public virtual void BeforeQueryMultiple(CancellableTraceLog log)
{
throw new NotImplementedException();
}
public virtual void BeforeSum(CancellableTraceLog log)
{
throw new NotImplementedException();
}
public virtual void BeforeSumAll(CancellableTraceLog log)
{
throw new NotImplementedException();
}
public virtual void BeforeTruncate(CancellableTraceLog log)
{
throw new NotImplementedException();
}
public virtual void BeforeUpdate(CancellableTraceLog log)
{
throw new NotImplementedException();
}
public virtual void BeforeUpdateAll(CancellableTraceLog log)
{
throw new NotImplementedException();
}
#endregion
#region After
public virtual void AfterAverage(TraceLog log)
{
throw new NotImplementedException();
}
public virtual void AfterAverageAll(TraceLog log)
{
throw new NotImplementedException();
}
public virtual void AfterBatchQuery(TraceLog log)
{
throw new NotImplementedException();
}
public virtual void AfterCount(TraceLog log)
{
throw new NotImplementedException();
}
public virtual void AfterCountAll(TraceLog log)
{
throw new NotImplementedException();
}
public virtual void AfterDelete(TraceLog log)
{
throw new NotImplementedException();
}
public virtual void AfterDeleteAll(TraceLog log)
{
throw new NotImplementedException();
}
public virtual void AfterExecuteNonQuery(TraceLog log)
{
throw new NotImplementedException();
}
public virtual void AfterExecuteQuery(TraceLog log)
{
throw new NotImplementedException();
}
public virtual void AfterExecuteReader(TraceLog log)
{
throw new NotImplementedException();
}
public virtual void AfterExecuteScalar(TraceLog log)
{
throw new NotImplementedException();
}
public virtual void AfterExists(TraceLog log)
{
throw new NotImplementedException();
}
public virtual void AfterInsert(TraceLog log)
{
throw new NotImplementedException();
}
public virtual void AfterInsertAll(TraceLog log)
{
throw new NotImplementedException();
}
public virtual void AfterMax(TraceLog log)
{
throw new NotImplementedException();
}
public virtual void AfterMaxAll(TraceLog log)
{
throw new NotImplementedException();
}
public virtual void AfterMerge(TraceLog log)
{
throw new NotImplementedException();
}
public virtual void AfterMergeAll(TraceLog log)
{
throw new NotImplementedException();
}
public virtual void AfterMin(TraceLog log)
{
throw new NotImplementedException();
}
public virtual void AfterMinAll(TraceLog log)
{
throw new NotImplementedException();
}
public virtual void AfterQuery(TraceLog log)
{
throw new NotImplementedException();
}
public virtual void AfterQueryAll(TraceLog log)
{
throw new NotImplementedException();
}
public virtual void AfterQueryMultiple(TraceLog log)
{
throw new NotImplementedException();
}
public virtual void AfterSum(TraceLog log)
{
throw new NotImplementedException();
}
public virtual void AfterSumAll(TraceLog log)
{
throw new NotImplementedException();
}
public virtual void AfterTruncate(TraceLog log)
{
throw new NotImplementedException();
}
public virtual void AfterUpdate(TraceLog log)
{
throw new NotImplementedException();
}
public virtual void AfterUpdateAll(TraceLog log)
{
throw new NotImplementedException();
}
#endregion
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment