private static void PreInit() { var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, RepositorySettings.CONFIG_FILE); var doc = XLinqHelper.GetConfigDocument(path); var root = doc.Element("Repository"); //model if (root == null) { _model = new RepositoryModel { DriverType = RepositorySettings.DEFAULT_DRIVER.AsEnum <DriverType>(), ConnectionString = RepositorySettings.DEFAULT_CONNECTION_STRING, Options = new Options { CommandTimeOut = RepositorySettings.COMMAND_TIME_OUT, MigrationsEnabled = true, CreateDatabaseIfNotExists = true, MigrationDataLossAllowed = false } }; } else { _model = new RepositoryModel { DriverType = root.GetElementValue("DriverType").AsEnum <DriverType>(), ConnectionString = root.GetElementValue("ConnectionString") }; var options = root.Element("Options"); if (options != null) { _model.Options = new Options { CommandTimeOut = options.GetElementValue("CommandTimeOut").AsInt(), DefaultSchema = options.GetElementValue("DefaultSchema"), MigrationsEnabled = options.GetElementValue("MigrationsEnabled").AsBoolString(), CreateDatabaseIfNotExists = options.GetElementValue("CreateDatabaseIfNotExists").AsBoolString(), MigrationDataLossAllowed = options.GetElementValue("MigrationDataLossAllowed").AsBoolString() }; } } }
private static void PreInit() { var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, BulkCopySettings.CONFIG_FILE); var doc = XLinqHelper.GetConfigDocument(path); var root = doc.Element("Repository"); _model = new BulkCopyModel { MajorVersion = root.GetElementValue("MajorVersion").AsEnum <PgVersions>() }; var connection = root.Element("Connection"); _model.Connection = new ConnectionSettings { Host = connection.GetElementValue("Host"), Database = connection.GetElementValue("Database"), Port = connection.GetElementValue("Port").AsInt(), UserName = connection.GetElementValue("UserName"), Password = connection.GetElementValue("Password") }; }