Skip to content

Commit

Permalink
Merge pull request #195 from bzbetty/AddTriggeredDbContextFactoryServ…
Browse files Browse the repository at this point in the history
…iceProvider

Allow AddTriggeredDbContextFactory to use to the service provider
  • Loading branch information
koenbeuk authored Aug 18, 2024
2 parents 7f3cae2 + f894084 commit 0d9619f
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ public static IServiceCollection AddTriggeredDbContextPool<TContext, TImplementa
return serviceCollection;
}

public static IServiceCollection AddTriggeredDbContextFactory<TContext>(this IServiceCollection serviceCollection, Action<DbContextOptionsBuilder>? optionsAction = null, ServiceLifetime lifetime = ServiceLifetime.Singleton)
public static IServiceCollection AddTriggeredDbContextFactory<TContext>(this IServiceCollection serviceCollection, Action<IServiceProvider, DbContextOptionsBuilder>? optionsAction = null, ServiceLifetime lifetime = ServiceLifetime.Singleton)
where TContext : DbContext
{
serviceCollection.AddDbContextFactory<TContext>(options => {
optionsAction?.Invoke(options);
serviceCollection.AddDbContextFactory<TContext>((serviceProvider, options) => {
optionsAction?.Invoke(serviceProvider, options);
options.UseTriggers();
}, lifetime);

Expand Down

0 comments on commit 0d9619f

Please sign in to comment.