public PluginPermissionsManager GetPermissionsManager(string connectionString)
        {
            var contextFactory = new CaseManagementPnDbContextFactory();
            var context        = contextFactory.CreateDbContext(new[] { connectionString });

            return(new PluginPermissionsManager(context));
        }
示例#2
0
        //public RentableItemsPnDbAnySql db;

        public void GetContext(string connectionStr)
        {
            CaseManagementPnDbContextFactory contextFactory = new CaseManagementPnDbContextFactory();

            DbContext = contextFactory.CreateDbContext(new[] { connectionStr });

            DbContext.Database.Migrate();
            DbContext.Database.EnsureCreated();
        }
        public void SeedDatabase(string connectionString)
        {
            var contextFactory = new CaseManagementPnDbContextFactory();

            using (var context = contextFactory.CreateDbContext(new [] { connectionString }))
            {
                CaseManagementPluginSeed.SeedData(context);
            }
        }
        public void ConfigureDbContext(IServiceCollection services, string connectionString)
        {
            _connectionString = connectionString;
            services.AddDbContext <eFormCaseManagementPnDbContext>(o => o.UseMySql(connectionString, new MariaDbServerVersion(
                                                                                       new Version(10, 4, 0)), mySqlOptionsAction: builder =>
            {
                builder.EnableRetryOnFailure();
                builder.MigrationsAssembly(PluginAssembly().FullName);
            }));

            var contextFactory = new CaseManagementPnDbContextFactory();
            var context        = contextFactory.CreateDbContext(new[] { connectionString });

            context.Database.Migrate();

            SeedDatabase(connectionString);
        }
示例#5
0
        public void ConfigureDbContext(IServiceCollection services, string connectionString)
        {
            _connectionString = connectionString;
            if (connectionString.ToLower().Contains("convert zero datetime"))
            {
                services.AddDbContext <eFormCaseManagementPnDbContext>(o => o.UseMySql(connectionString,
                                                                                       b => b.MigrationsAssembly(PluginAssembly().FullName)));
            }
            else
            {
                services.AddDbContext <eFormCaseManagementPnDbContext>(o => o.UseSqlServer(connectionString,
                                                                                           b => b.MigrationsAssembly(PluginAssembly().FullName)));
            }

            var contextFactory = new CaseManagementPnDbContextFactory();
            var context        = contextFactory.CreateDbContext(new[] { connectionString });

            context.Database.Migrate();

            SeedDatabase(connectionString);
        }