コード例 #1
0
 private static IConfiguration CreateDatabaseConfig()
 {
     var dbConfig = new Configuration.Configuration();
     dbConfig.SetValue("database.name", DatabaseName);
     dbConfig.SetValue("database.storageSystem", DefaultStorageSystemNames.Journaled);
     dbConfig.SetValue("database.basePath", Environment.CurrentDirectory);
     return dbConfig;
 }
コード例 #2
0
ファイル: NonQueryTests.cs プロジェクト: deveel/deveeldb
 protected override void OnAfterSetup(string testName)
 {
     var config = new Configuration.Configuration();
     config.SetValue("connection.userName", AdminUserName);
     config.SetValue("connection.password", AdminPassword);
     config.SetValue("connection.parameterStyle", QueryParameterStyle.Named);
     connection = Database.CreateDbConnection(config);
 }
コード例 #3
0
ファイル: ConnectionClient.cs プロジェクト: deveel/deveeldb
        private IConfiguration CreateDbConfig(DeveelDbConnectionStringBuilder settings)
        {
            var config = new Configuration.Configuration();

            var databaseName = settings.Database;
            var dataSource = settings.DataSource;

            var schema = settings.Schema;
            if (String.IsNullOrEmpty(schema))
                schema = "APP";

            config.SetValue("database.name", databaseName);
            config.SetValue("database.defaultSchema", schema);

            if (IsInMemory(dataSource)) {
                config.SetValue("database.storeType", "memory");
            } else if (IsSingleFile(dataSource)) {
                var index = dataSource.IndexOf('=');
                var fileName = dataSource.Substring(index + 1);

                config.SetValue("database.storeType", "file");
                config.SetValue("database.path", fileName);
            } else if (IsJournaled(dataSource)) {
                var index = dataSource.IndexOf('=');

                var path = dataSource.Substring(index + 1);
                config.SetValue("database.storeType", "journaled");
                config.SetValue("database.path", path);
            }

            foreach (KeyValuePair<string, object> pair in settings) {
                var key = pair.Key;
                var value = pair.Value;

                // TODO: normalize the key and convert the value to set into the configuration
                config.SetValue(key, value);
            }

            return config;
        }