当前位置: 首页>>代码示例>>C#>>正文


C# IConfigurationStore.GetAliasConfiguration方法代码示例

本文整理汇总了C#中IConfigurationStore.GetAliasConfiguration方法的典型用法代码示例。如果您正苦于以下问题:C# IConfigurationStore.GetAliasConfiguration方法的具体用法?C# IConfigurationStore.GetAliasConfiguration怎么用?C# IConfigurationStore.GetAliasConfiguration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IConfigurationStore的用法示例。


在下文中一共展示了IConfigurationStore.GetAliasConfiguration方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CheckConfigurationStore

        private void CheckConfigurationStore(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.Length, 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("sqlServer1.1"));
            //Assert.That(provider.Id, Is.EqualTo("sqlServer1.1"));
            //Assert.That(provider.Value, Is.EqualTo("sqlServer1.1"));
            //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(2));
            Assert.That(store.GetAliasConfiguration("Account").Value, Is.EqualTo(typeof(Account).AssemblyQualifiedName));

            Assert.That(store.TypeHandlers.Length, Is.EqualTo(2));
            Assert.That(store.GetTypeHandlerConfiguration("Boolean").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(4));
            //Assert.That(cacheModel.Attributes.ContainsKey(ConfigConstants.ATTRIBUTE_NAMESPACE), Is.True);

            // Result map
            //Assert.That(store.ResultMaps.Length, Is.EqualTo(14));
            //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"));
        }
开发者ID:techvenky,项目名称:mybatisnet,代码行数:95,代码来源:ModuleConfigurationTest.cs


注:本文中的IConfigurationStore.GetAliasConfiguration方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。