Skip to content

Commit

Permalink
Made IAuditStore dependency optional.
Browse files Browse the repository at this point in the history
  • Loading branch information
hikalkan committed May 6, 2015
1 parent 9ac67ff commit 9e3fc56
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Abp/Auditing/AuditingInterceptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,22 @@ namespace Abp.Auditing
internal class AuditingInterceptor : IInterceptor
{
public IAbpSession AbpSession { get; set; }

public ILogger Logger { get; set; }

private readonly IAuditingStore _auditingStore;
public IAuditingStore AuditingStore { get; set; }

private readonly IAuditingConfiguration _configuration;
private readonly IAuditInfoProvider _auditInfoProvider;

public AuditingInterceptor(IAuditingStore auditingStore, IAuditingConfiguration configuration, IAuditInfoProvider auditInfoProvider)
public AuditingInterceptor(IAuditingConfiguration configuration, IAuditInfoProvider auditInfoProvider)
{
_auditingStore = auditingStore;
_configuration = configuration;
_auditInfoProvider = auditInfoProvider;

AbpSession = NullAbpSession.Instance;
Logger = NullLogger.Instance;
AuditingStore = SimpleLogAuditingStore.Instance;
}

public void Intercept(IInvocation invocation)
Expand Down Expand Up @@ -74,7 +76,7 @@ public void Intercept(IInvocation invocation)
{
stopwatch.Stop();
auditInfo.ExecutionDuration = Convert.ToInt32(stopwatch.Elapsed.TotalMilliseconds);
_auditingStore.Save(auditInfo); //TODO: Call async when target method is async.
AuditingStore.Save(auditInfo); //TODO: Call async when target method is async.
}
}

Expand Down
6 changes: 6 additions & 0 deletions src/Abp/Auditing/SimpleLogAuditingStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ namespace Abp.Auditing
/// </summary>
public class SimpleLogAuditingStore : IAuditingStore
{
/// <summary>
/// Singleton instance.
/// </summary>
public static SimpleLogAuditingStore Instance { get { return SingletonInstance; } }
private static readonly SimpleLogAuditingStore SingletonInstance = new SimpleLogAuditingStore();

public ILogger Logger { get; set; }

public SimpleLogAuditingStore()
Expand Down

0 comments on commit 9e3fc56

Please sign in to comment.