public void GenerateDatabase(Configuration config) { Configuration = config; // ConnectionSettings settings = Configuration.DataStores.Default.Settings; _provider = config.DbInfo.DatabaseType; switch (_provider) { case DataProviders.SQLite: //settings.FullPath = settings.Path; //DbInfo.ConnectionString = settings.ConnectionString; //DbInfo.MasterConnectionString = settings.MasterConnectionString; break; default: //DbInfo.ConnectionString = settings.ConnectionString; //DbInfo.MasterConnectionString = settings.MasterConnectionString; DbInfo.ConnectionString = config.DbInfo.ConnectionString; DbInfo.MasterConnectionString = config.DbInfo.MasterConnectionString; break; } DbInfo.Provider = _provider; DbInfo.Database = Configuration.DbInfo.Database; DbInfo.Server = Configuration.DbInfo.Server; DbInfo.Authentication = Configuration.DbInfo.Authentication; DbInfo.User = Configuration.DbInfo.User; DbInfo.Password = Configuration.DbInfo.Password; var exists = DbInfo.DatabaseExists(); this.Queries.Append(GenerateDatabase(exists, Configuration)); }
/// <summary> /// Checks to see if the Default Data Store already exists /// </summary> /// <returns></returns> protected bool DataStoreExists() { switch (Provider) { case DataProviders.MYSQL: case DataProviders.Oracle: case DataProviders.SQL: break; case DataProviders.SQLite: return(DbInfo.DatabaseExists(Configuration.Key)); default: throw new Exception("Unsupported data provider"); } return(false); }