We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 31e7482 commit 058756aCopy full SHA for 058756a
src/Libraries/Infrastructure/DatabaseExtensions.cs
@@ -14,6 +14,13 @@ public static class DatabaseExtensions
14
{
15
public static IHostApplicationBuilder AddDatabaseServices(this IHostApplicationBuilder builder)
16
17
+ if (!builder.Services.Any(x => x.ServiceType == typeof(ICurrentUserService)))
18
+ {
19
+ throw new InvalidOperationException(
20
+ "ICurrentUserService must be registered before calling AddDatabaseServices. " +
21
+ "Register an implementation using builder.Services.AddScoped<ICurrentUserService, YourImplementation>()");
22
+ }
23
+
24
builder.Services.AddScoped<AuditSaveChangesInterceptor>();
25
26
builder.Services.AddDbContext<AuditContext>((sp, options) =>
0 commit comments