本文整理汇总了C#中System.Configuration.Configuration.SetValue方法的典型用法代码示例。如果您正苦于以下问题:C# Configuration.SetValue方法的具体用法?C# Configuration.SetValue怎么用?C# Configuration.SetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Configuration.Configuration
的用法示例。
在下文中一共展示了Configuration.SetValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateDatabaseConfig
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: OnAfterSetup
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: CreateDbConfig
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;
}