private static FrameworkConfigurator RegisterMigrationAction(this FrameworkConfigurator configurator) { return(configurator.RegisterInitializationAction(async resolver => { var factory = resolver.Resolve <IFrameworkContextFactory>(); using (var context = await factory.CreateContext()) { context.Migrate(); } })); }
public static FrameworkConfigurator UseScopedContext <TContextInterface>( this FrameworkConfigurator configurator, Func <DbContextOptions, TContextInterface> factoryMethod) where TContextInterface : IScopedContex { configurator.RegisterSingelton < ISessionScopedContextFactory <TContextInterface>, SessionScopedContextFactory <TContextInterface> >(); configurator.RegisterInitializationAction(async resolver => { var factory = resolver.Resolve <ISessionScopedContextFactory <TContextInterface> >(); factory.Initialize(factoryMethod); }); return(configurator); }