本文整理汇总了C#中IConfigurationStore.GetProviderConfiguration方法的典型用法代码示例。如果您正苦于以下问题:C# IConfigurationStore.GetProviderConfiguration方法的具体用法?C# IConfigurationStore.GetProviderConfiguration怎么用?C# IConfigurationStore.GetProviderConfiguration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IConfigurationStore
的用法示例。
在下文中一共展示了IConfigurationStore.GetProviderConfiguration方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckResource
private void CheckResource(IConfigurationStore store)
{
Console.WriteLine(store.ToString());
Assert.That(store.Properties.Length, Is.EqualTo(14));
Assert.That(store.GetPropertyConfiguration("useStatementNamespaces").Value, Is.EqualTo("false"));
Assert.That(store.Settings.Count, Is.EqualTo(4));
Assert.That(store.GetSettingConfiguration("validateSqlMap").Value, Is.EqualTo("false"));
Assert.That(store.Providers.Length, Is.EqualTo(17));
IConfiguration informixProvider = store.GetProviderConfiguration("Informix");
Assert.That(informixProvider.Attributes["description"], Is.EqualTo("Informix NET Provider, 2.81.0.0"));
Assert.That(informixProvider.Attributes["commandBuilderClass"], Is.EqualTo("IBM.Data.Informix.IfxCommandBuilder"));
Assert.That(store.Databases.Length, Is.EqualTo(1));
Assert.That(store.Databases[0].Children.Count, Is.EqualTo(2));
IConfiguration provider = store.Databases[0].Children.Find(DataConstants.ELEMENT_PROVIDER)[0];
Assert.That(provider, Is.Not.Null);
Assert.That(provider.Attributes[DataConstants.ATTRIBUTE_NAME], Is.EqualTo("sqlServer2.0"));
Assert.That(provider.Id, Is.EqualTo("sqlServer2.0"));
Assert.That(provider.Value, Is.EqualTo("sqlServer2.0"));
Assert.That(provider.Type, Is.EqualTo(DataConstants.ELEMENT_PROVIDER));
IConfiguration datasource = store.Databases[0].Children.Find(DataConstants.ELEMENT_DATASOURCE)[0];
Assert.That(datasource, Is.Not.Null);
Assert.That(datasource.Value.StartsWith("data source="));
Assert.That(datasource.Type, Is.EqualTo(DataConstants.ELEMENT_DATASOURCE));
Assert.That(store.Alias.Length, Is.EqualTo(12));
Assert.That(store.GetAliasConfiguration("Account").Value, Is.EqualTo("MyBatis.DataMapper.SqlClient.Test.Domain.Account, MyBatis.DataMapper.SqlClient.Test"));
Assert.That(store.TypeHandlers.Length, Is.EqualTo(2));
Assert.That(store.GetTypeHandlerConfiguration("bool").Attributes.Count, Is.EqualTo(3));
Assert.That(store.GetTypeHandlerConfiguration("string").Attributes.Count, Is.EqualTo(2));
// Cache model
Assert.That(store.CacheModels.Length, Is.EqualTo(2));
IConfiguration cacheModel = store.CacheModels[0];
Assert.That(cacheModel.Children.Count, Is.EqualTo(2));
Assert.That(cacheModel.Attributes.ContainsKey(ConfigConstants.ATTRIBUTE_NAMESPACE), Is.True);
// Result map
Assert.That(store.ResultMaps.Length, Is.EqualTo(16));
IConfiguration resultMap = store.GetResultMapConfiguration("Account.account-result-constructor");
Assert.IsNotNull(resultMap);
Assert.That(resultMap.Children.Count, Is.EqualTo(4));
IConfiguration constructor = resultMap.Children.Find(ConfigConstants.ELEMENT_CONSTRUCTOR)[0];
Assert.IsNotNull(constructor);
Assert.That(constructor.Children.Count, Is.EqualTo(3));
ConfigurationCollection arguments = constructor.Children.Find(ConfigConstants.ELEMENT_ARGUMENT);
Assert.IsNotEmpty(arguments);
Assert.That(arguments.Count, Is.EqualTo(3));
Assert.That(arguments[0].Attributes[ConfigConstants.ATTRIBUTE_ARGUMENTNAME], Is.EqualTo("identifiant"));
ConfigurationCollection results = resultMap.Children.Find(ConfigConstants.ELEMENT_RESULT);
Assert.IsNotEmpty(results);
Assert.That(results.Count, Is.EqualTo(3));
Assert.That(results[0].Attributes[ConfigConstants.ATTRIBUTE_PROPERTY], Is.EqualTo("EmailAddress"));
// Parameter map
Assert.That(store.ParameterMaps.Length, Is.EqualTo(11));
IConfiguration parameterMap = store.GetParameterMapConfiguration("Account.insert-params");
Assert.IsNotNull(parameterMap);
Assert.That(parameterMap.Children.Count, Is.EqualTo(6));
ConfigurationCollection parameters = parameterMap.Children.Find(ConfigConstants.ELEMENT_PARAMETER);
Assert.IsNotEmpty(parameters);
Assert.That(parameters.Count, Is.EqualTo(6));
Assert.That(parameters[4].Attributes.Count, Is.EqualTo(4));
Assert.That(parameters[3].Attributes[ConfigConstants.ATTRIBUTE_PROPERTY], Is.EqualTo("EmailAddress"));
// sql statement in Mapping2.xml
Assert.That(store.Statements.Length, Is.EqualTo(97));
IConfiguration sqlStatement = store.GetStatementConfiguration("includeComplex");
Assert.IsNotNull(sqlStatement);
Assert.That(sqlStatement.Attributes.ContainsKey(ConfigConstants.ATTRIBUTE_NAMESPACE), Is.True);
Assert.That(sqlStatement.Children.Count, Is.EqualTo(1));
IConfiguration child = sqlStatement.Children[0];//dynamic
Assert.That(child.Children.Count, Is.EqualTo(1));
child = child.Children[0];//isParameterPresent
Assert.That(child.Children.Count, Is.EqualTo(3));
child = child.Children[1];//isNotEmpty
Assert.That(child.Attributes.Count, Is.EqualTo(2));
Assert.IsTrue(child.Attributes.ContainsKey("prepend"));
Assert.IsTrue(child.Attributes.ContainsKey("property"));
Assert.That(child.Attributes["prepend"], Is.EqualTo("and"));
Assert.That(child.Attributes["property"], Is.EqualTo("FirstName"));
}