本文整理汇总了C#中Microsoft.Practices.EnterpriseLibrary.Common.Configuration.DictionaryConfigurationSource.Add方法的典型用法代码示例。如果您正苦于以下问题:C# DictionaryConfigurationSource.Add方法的具体用法?C# DictionaryConfigurationSource.Add怎么用?C# DictionaryConfigurationSource.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Practices.EnterpriseLibrary.Common.Configuration.DictionaryConfigurationSource
的用法示例。
在下文中一共展示了DictionaryConfigurationSource.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateConfiguration
public static DictionaryConfigurationSource GenerateConfiguration()
{
DictionaryConfigurationSource sections = new DictionaryConfigurationSource();
sections.Add(DatabaseSettings.SectionName, GenerateDatabaseSettings());
sections.Add(CacheManagerSettings.SectionName, GenerateCacheManagerSettings());
return sections;
}
示例2: SetUp
public void SetUp()
{
loggingSettings = new LoggingSettings();
connectionStringsSection = new ConnectionStringsSection();
configurationSource = new DictionaryConfigurationSource();
configurationSource.Add(LoggingSettings.SectionName, loggingSettings);
configurationSource.Add("connectionStrings", connectionStringsSection);
}
开发者ID:jmeckley,项目名称:Enterprise-Library-5.0,代码行数:8,代码来源:FormattedDatabaseTraceListenerPolicyCreatorFixture.cs
示例3: GenerateConfiguration
public static DictionaryConfigurationSource GenerateConfiguration()
{
DictionaryConfigurationSource source = new DictionaryConfigurationSource();
source.Add(DatabaseSettings.SectionName, GenerateDatabaseSettings());
source.Add(OracleConnectionSettings.SectionName, GenerateOracleConnectionSettings());
source.Add("connectionStrings", GenerateConnectionStringSection());
return source;
}
示例4: SetUp
public void SetUp()
{
settings = new CacheManagerSettings();
dbSettings = new DatabaseSettings();
configurationSource = new DictionaryConfigurationSource();
configurationSource.Add(CacheManagerSettings.SectionName, settings);
configurationSource.Add(DatabaseSettings.SectionName, dbSettings);
}
示例5: SetUp
public void SetUp()
{
settings = new ExceptionHandlingSettings();
configurationSource = new DictionaryConfigurationSource();
configurationSource.Add(ExceptionHandlingSettings.SectionName, settings);
configurationSource.Add(
InstrumentationConfigurationSection.SectionName,
new InstrumentationConfigurationSection(false, false));
}
示例6: CreateNamedDatabaseInstanceWithDictSource
public void CreateNamedDatabaseInstanceWithDictSource()
{
DictionaryConfigurationSource source = new DictionaryConfigurationSource();
DatabaseSettings settings = new DatabaseSettings();
ConnectionStringsSection connSection = GetConnectionStringsSection();
source.Add("dataConfiguration", settings);
source.Add("connectionStrings", connSection);
DatabaseProviderFactory factory = new DatabaseProviderFactory(source);
Database dbIns = factory.Create(instanceName);
Assert.IsNotNull(dbIns);
}
示例7: CanBuildDefaultLogger
public void CanBuildDefaultLogger()
{
DictionaryConfigurationSource configurationSource = new DictionaryConfigurationSource();
configurationSource.Add(InstrumentationConfigurationSection.SectionName, new InstrumentationConfigurationSection(true, true, "fooApplicationName"));
configurationSource.Add(CacheManagerSettings.SectionName, new CacheManagerSettings());
DefaultCachingEventLogger logger
=
EnterpriseLibraryContainer.CreateDefaultContainer(configurationSource).GetInstance
<DefaultCachingEventLogger>();
Assert.IsNotNull(logger);
}
示例8: GetConfigurationSource
private DictionaryConfigurationSource GetConfigurationSource()
{
DictionaryConfigurationSource sections = new DictionaryConfigurationSource();
SecuritySettings securityConfig = new SecuritySettings();
securityConfig.DefaultSecurityCacheProviderName = "provider1";
securityConfig.SecurityCacheProviders.Add(new MockSecurityCacheProviderData("provider1", typeof(MockSecurityCacheProvider)));
sections.Add(SecuritySettings.SectionName, securityConfig);
InstrumentationConfigurationSection instrumentationConfig = new InstrumentationConfigurationSection(true, true, true);
sections.Add(InstrumentationConfigurationSection.SectionName, instrumentationConfig);
return sections;
}
示例9: CreateConfigurationSource
public static DictionaryConfigurationSource CreateConfigurationSource()
{
DictionaryConfigurationSource source = new DictionaryConfigurationSource();
DatabaseSettings settings = new DatabaseSettings();
settings.DefaultDatabase = "SqlCeTestConnection";
ConnectionStringsSection section = new ConnectionStringsSection();
section.ConnectionStrings.Add(new ConnectionStringSettings("SqlCeTestConnection", "Data Source='testdb.sdf'", "System.Data.SqlServerCe.3.5"));
source.Add(DatabaseSettings.SectionName, settings);
source.Add("connectionStrings", section);
return source;
}
示例10: SetUp
public void SetUp()
{
cryptoSettings = new CryptographySettings();
settings = new CacheManagerSettings();
SymmetricStorageEncryptionProviderData encrytionProvider = new SymmetricStorageEncryptionProviderData(providerName, symmetricInstance);
settings.EncryptionProviders.Add(encrytionProvider);
cryptoSettings.SymmetricCryptoProviders.Add(new DpapiSymmetricCryptoProviderData(symmetricInstance, DataProtectionScope.CurrentUser));
configurationSource = new DictionaryConfigurationSource();
configurationSource.Add(CacheManagerSettings.SectionName, settings);
configurationSource.Add(CryptographySettings.SectionName, cryptoSettings);
}
开发者ID:jmeckley,项目名称:Enterprise-Library-5.0,代码行数:15,代码来源:SymmetricStorageEncryptionProviderInstatiationFixture.cs
示例11: DatabaseCreatedByProviderFactoryIsASqlCeDatabase
public void DatabaseCreatedByProviderFactoryIsASqlCeDatabase()
{
DictionaryConfigurationSource source = new DictionaryConfigurationSource();
DatabaseSettings settings = new DatabaseSettings();
ConnectionStringsSection connSection = GetConnectionStringsSection();
DbProviderMapping providerMapping = GetProviderMapping();
settings.ProviderMappings.Add(providerMapping);
source.Add("dataConfiguration", settings);
source.Add("connectionStrings", connSection);
DatabaseProviderFactory factory = new DatabaseProviderFactory(source);
Database db = factory.Create(instanceName);
Assert.IsNotNull(db);
Assert.AreSame(typeof(SqlCeDatabase), db.GetType());
}
示例12: Setup
public void Setup()
{
var configSource = new DictionaryConfigurationSource();
configSource.Add(DatabaseSettings.SectionName, new DatabaseSettings());
configSettings = new DatabaseSyntheticConfigSettings(configSource.GetSection);
}
示例13: ShouldCreateCorrectMatchingRule
public void ShouldCreateCorrectMatchingRule()
{
ValidationFactory.SetDefaultConfigurationValidatorFactory(new ConfigurationValidatorFactory(new DictionaryConfigurationSource()));
PolicyData policyData = new PolicyData("Validate Parameters");
policyData.Handlers.Add(new ValidationCallHandlerData());
ParameterTypeMatchingRuleData matchingRuleData = GetParameterTypeMatchingRuleData();
policyData.MatchingRules.Add(matchingRuleData);
PolicyInjectionSettings settings = new PolicyInjectionSettings();
settings.Policies.Add(policyData);
DictionaryConfigurationSource configSource = new DictionaryConfigurationSource();
configSource.Add(PolicyInjectionSettings.SectionName, settings);
IUnityContainer container = new UnityContainer().AddNewExtension<Interception>();
settings.ConfigureContainer(container);
RuleDrivenPolicy policy = container.Resolve<RuleDrivenPolicy>("Validate Parameters");
List<IMatchingRule> rules = RuleCreationFixture.GetRules(policy);
Assert.IsNotNull(policy);
Assert.IsTrue(rules[0] is ParameterTypeMatchingRule);
ParameterTypeMatchingRule rule = (ParameterTypeMatchingRule)(rules[0]);
Assert.AreEqual(3, rule.ParameterMatches.Count());
for (int i = 0; i < matchingRuleData.Matches.Count; ++i)
{
AssertMatchDataEqual(
matchingRuleData.Matches[i],
rule.ParameterMatches.ElementAt(i),
"Mismatch at element {0}",
i);
}
}
示例14: Setup
public void Setup()
{
var configSource = new DictionaryConfigurationSource();
configSource.Add(DatabaseSettings.SectionName, new DatabaseSettings { DefaultDatabase = "default" });
configSettings = new DatabaseSyntheticConfigSettings(configSource);
}
开发者ID:jmeckley,项目名称:Enterprise-Library-5.0,代码行数:7,代码来源:DatabaseSyntheticConfigurationSettingsFixture.cs
示例15: SkipsConnectionStringsWithoutProviderNamesOrWithProviderNamesWhichDoNotMapToAProviderFactory
public void SkipsConnectionStringsWithoutProviderNamesOrWithProviderNamesWhichDoNotMapToAProviderFactory()
{
DictionaryConfigurationSource configurationSource = new DictionaryConfigurationSource();
ConnectionStringsSection section = new ConnectionStringsSection();
section.ConnectionStrings.Add(new ConnectionStringSettings("cs1", "cs1", "System.Data.SqlClient"));
section.ConnectionStrings.Add(new ConnectionStringSettings("cs2", "cs2"));
section.ConnectionStrings.Add(new ConnectionStringSettings("cs3", "cs3", "a bogus provider name"));
section.ConnectionStrings.Add(new ConnectionStringSettings("cs4", "cs4", "System.Data.SqlClient"));
configurationSource.Add("connectionStrings", section);
var factory = new DatabaseProviderFactory(configurationSource.GetSection);
Assert.AreEqual("cs1", factory.Create("cs1").ConnectionString);
Assert.AreEqual("cs4", factory.Create("cs4").ConnectionString);
try
{
factory.Create("cs2");
Assert.Fail("should have thrown");
}
catch (InvalidOperationException)
{
// expected, connection string is ignored
}
try
{
factory.Create("cs3");
Assert.Fail("should have thrown");
}
catch (InvalidOperationException)
{
// expected, connection string is ignored
}
}