public void Execute(string tenantKey) { string createDBScript = CreateDb.GetCreateDBScript(this._sqlRootFolder, this._dbName); // Create DB if (!DBExist()) { _server.ConnectionContext.ExecuteNonQuery(createDBScript); } // Execute create schema file string createSchemaScript = File.ReadAllText(_pathToSqlCreateScript); createSchemaScript = createSchemaScript.Insert(0, "USE " + this._dbName + Environment.NewLine); _server.ConnectionContext.ExecuteNonQuery(createSchemaScript); }
public bool DBExist() { return(((int)_server.ConnectionContext.ExecuteScalar(CreateDb.DBExistQuery(this._dbName))) > 0); }