Esempio n. 1
0
        public void CreateTable(string conString, DatabaseType dbType, Type entityType, string suffix)
        {
            DbContextParamters options = new DbContextParamters
            {
                ConnectionString = conString,
                DbType           = dbType,
                EntityTypes      = new Type[] { entityType },
                Suffix           = suffix
            };

            using DbContext dbContext = GetDbContext(options, _optionsMonitor.BuildOption(null));
            var databaseCreator = dbContext.Database.GetService <IDatabaseCreator>() as RelationalDatabaseCreator;

            try
            {
                databaseCreator.CreateTables();
            }
            catch
            {
            }
        }