Skip to content

Commit

Permalink
expose UseInterceptor
Browse files Browse the repository at this point in the history
  • Loading branch information
0xF6 committed May 26, 2024
1 parent e414cd5 commit dd2d6a6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<Version>1.0-rc.7</Version>
<Version>1.0-rc.8</Version>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<Deterministic>true</Deterministic>
<Features>strict</Features>
Expand Down
8 changes: 8 additions & 0 deletions src/features/Database/DatabaseFeature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using JetBrains.Annotations;
using Microsoft.AspNetCore.Builder;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Diagnostics.HealthChecks;

Expand Down Expand Up @@ -58,6 +59,12 @@ public IDatabaseAdapter UseDiagnostic(bool sensitiveEnabled = false)
Builder.EnableDetailedErrors();
return this;
}

public IDatabaseAdapter UseInterceptor<T>() where T : IInterceptor, new()
{
Builder.AddInterceptors(Activator.CreateInstance<T>());
return this;
}
}

public interface IDatabaseDbContextOptionsAccessor
Expand All @@ -70,4 +77,5 @@ public interface IDatabaseAdapter
{
IDatabaseAdapter UseLazyLoading();
IDatabaseAdapter UseDiagnostic(bool sensitiveEnabled = false);
IDatabaseAdapter UseInterceptor<T>() where T : IInterceptor, new();
}

0 comments on commit dd2d6a6

Please sign in to comment.