private static DbConnection GetConnectionString(ConfigUtil.ConfigData config) { DbConnection connection; if (config == null || config.Sqlite) { var sqlitecn = new SQLiteConnectionStringBuilder(); sqlitecn.DataSource = dbpath; sqlitecn.FailIfMissing = false; //sqlitecn.FailIfMissing = false; connection = new SQLiteConnection() { ConnectionString = sqlitecn.ConnectionString }; } else { var sqlcn = new SqlConnectionStringBuilder(); sqlcn.DataSource = config.MySQLServer; sqlcn.UserID = config.UserID; sqlcn.Password = config.Password; connection = new SqlConnection() { ConnectionString = sqlcn.ConnectionString }; } return(connection); }
public void SetConnectionStringParameters(ConfigUtil.ConfigData config) { connectionStringBuilder.Server = config.MySQLServer; connectionStringBuilder.Database = config.Database; connectionStringBuilder.UserID = config.UserID; connectionStringBuilder.Password = config.Password; }
public DatabaseLink(ConfigUtil.ConfigData config) : base(GetConnectionString(config), true) { }
public DatabaseLink(ConfigUtil.ConfigData config) { SetConnectionStringParameters(config); }