Skip to content

Commit

Permalink
Adding create methods to IAuditScopeFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
thepirat000 committed Sep 3, 2024
1 parent 458aff2 commit f9ff637
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
15 changes: 4 additions & 11 deletions src/Audit.NET/AuditScopeFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,7 @@ public async Task<IAuditScope> CreateAsync(AuditScopeOptions options, Cancellati
return await auditScope.StartAsync(cancellationToken);
}

#endregion

/// <summary>
/// Creates an audit scope with the given creation options as a Fluent API.
/// </summary>
/// <param name="config">Fluent API to configure the Audit Scope creation options</param>
/// <inheritdoc />
[MethodImpl(MethodImplOptions.NoInlining)]
public IAuditScope Create(Action<IAuditScopeOptionsConfigurator> config)
{
Expand All @@ -65,11 +60,7 @@ public IAuditScope Create(Action<IAuditScopeOptionsConfigurator> config)
return auditScope.Start();
}

/// <summary>
/// Creates an audit scope with the given creation options as a Fluent API.
/// </summary>
/// <param name="config">Fluent API to configure the Audit Scope creation options</param>
/// <param name="cancellationToken">The Cancellation Token.</param>
/// <inheritdoc />
[MethodImpl(MethodImplOptions.NoInlining)]
public async Task<IAuditScope> CreateAsync(Action<IAuditScopeOptionsConfigurator> config, CancellationToken cancellationToken = default)
{
Expand All @@ -80,6 +71,8 @@ public async Task<IAuditScope> CreateAsync(Action<IAuditScopeOptionsConfigurator
return await auditScope.StartAsync(cancellationToken);
}

#endregion

/// <summary>
/// Creates an audit scope for a target object and an event type.
/// </summary>
Expand Down
13 changes: 13 additions & 0 deletions src/Audit.NET/IAuditScopeFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,18 @@ public interface IAuditScopeFactory
/// <param name="options">The Audit Scope creation options</param>
/// <param name="cancellationToken">The Cancellation Token.</param>
Task<IAuditScope> CreateAsync(AuditScopeOptions options, CancellationToken cancellationToken = default);

/// <summary>
/// Creates an audit scope with the given creation options as a Fluent API.
/// </summary>
/// <param name="config">Fluent API to configure the Audit Scope creation options</param>
IAuditScope Create(Action<IAuditScopeOptionsConfigurator> config);

/// <summary>
/// Creates an audit scope with the given creation options as a Fluent API.
/// </summary>
/// <param name="config">Fluent API to configure the Audit Scope creation options</param>
/// <param name="cancellationToken">The Cancellation Token.</param>
Task<IAuditScope> CreateAsync(Action<IAuditScopeOptionsConfigurator> config, CancellationToken cancellationToken = default);
}
}

0 comments on commit f9ff637

Please sign in to comment.