public static void ExecuteQuery(NoDbSettingConnection connection, string query) { if (connection.ConnectionType == NoDbConnectionType.Mssql || connection.ConnectionType == NoDbConnectionType.Mysql || connection.ConnectionType == NoDbConnectionType.Postgres) { var context = EmptyDbContext.Init(connection.ConnectionType.ToString(), connection.ConnectionString); context.Database.ExecuteSqlRaw(query); } }
static void CreatePhysicalDatabaseIfNotExists(string connectionString, ICommerceDbProvider provider) { var conn = DbProviderFactories.GetFactory(provider.InvariantName).CreateConnection(); conn.ConnectionString = connectionString; // TODO: Do not generate __MigrateHistory table or ...? using (var dbContext = new EmptyDbContext(conn)) { dbContext.Database.CreateIfNotExists(); } }
public static void DropDatabase(string connectionString) { SqlConnection.ClearAllPools(); using (var context = new EmptyDbContext(connectionString)) { var db = context.Database; // drop the database if exists db.Delete(); } }
static void CreatePhysicalDatabaseIfNotExists(string connectionString) { // TODO: Do not generate __MigrateHistory table or ...? using (var dbContext = new EmptyDbContext(connectionString)) { dbContext.Database.CreateIfNotExists(); } }
public HomeController() { _dbContext = EmptyDbContext.Create(); }