public static void WithEFCoreOutbox <T>(this IServiceRegistrar services, Action <EFCoreOutbox.OutboxSettings> config ) where T : DbContext { OutboxSettings settings = new OutboxSettings(); if (config != null) { config.Invoke(settings); } services.AddSingleton <OutboxSettings>(settings); services.AddSingleton <IOutbox, Outbox <T> >(true); services.AddTransient <IOutboxSession, OutboxSession <T> >(); }
private static IServiceRegistrar Register(this IServiceRegistrar serviceRegistrar, Type serviceType, Type implementationType, RegistrationScope registrationScope) { switch (registrationScope) { case RegistrationScope.Singleton: return(serviceRegistrar.AddSingleton(serviceType, implementationType)); case RegistrationScope.Scoped: return(serviceRegistrar.AddScoped(serviceType, implementationType)); case RegistrationScope.Transient: return(serviceRegistrar.AddTransient(serviceType, implementationType)); default: break; } return(serviceRegistrar); }