public PluginPermissionsManager GetPermissionsManager(string connectionString) { var contextFactory = new InventoryPnContextFactory(); var context = contextFactory.CreateDbContext(new[] { connectionString }); return(new PluginPermissionsManager(context)); }
private void GetContext(string connectionStr) { var contextFactory = new InventoryPnContextFactory(); DbContext = contextFactory.CreateDbContext(new[] { connectionStr }); DbContext.Database.Migrate(); DbContext.Database.EnsureCreated(); }
public void SeedDatabase(string connectionString) { // Get DbContext var contextFactory = new InventoryPnContextFactory(); using var context = contextFactory.CreateDbContext(new[] { connectionString }); // Seed configuration InventoryPluginSeed.SeedData(context); }
public void ConfigureDbContext(IServiceCollection services, string connectionString) { _connectionString = connectionString; services.AddDbContext <InventoryPnDbContext>(o => o.UseMySql(connectionString, new MariaDbServerVersion( new Version(10, 4, 0)), mySqlOptionsAction: builder => { builder.EnableRetryOnFailure(); builder.MigrationsAssembly(PluginAssembly().FullName); })); var contextFactory = new InventoryPnContextFactory(); var context = contextFactory.CreateDbContext(new[] { connectionString }); context.Database.Migrate(); // Seed database SeedDatabase(connectionString); }
private InventoryPnDbContext GetContext() { var contextFactory = new InventoryPnContextFactory(); return(contextFactory.CreateDbContext(new[] { _connectionString })); }