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


C# XmlElement.ShouldBeNamed方法代码示例

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


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

示例1: CsvQueryColumnConfiguration

        /// <summary>
        /// Instantiates a <see cref="CsvQueryColumnConfiguration"/>
        /// </summary>
        /// <param name="xmlElement"></param>
        public CsvQueryColumnConfiguration(XmlElement xmlElement)
        {
            // validate element
            xmlElement.ShouldBeNamed(ColumnElementName);

            // get attribute values
            _tag = xmlElement.GetAttributeValue(TagAttributeName);
            _description = xmlElement.GetAttributeValue(DescriptionAttributeName);
            _mappedProperty = xmlElement.GetAttributeValue(MappedPropertyAttributeName, false);
            _enabled = bool.Parse(xmlElement.GetAttributeValue(EnabledAttributeName));
        }
开发者ID:CarlosVV,项目名称:mediavf,代码行数:15,代码来源:CsvQueryColumnConfiguration.cs

示例2: Load

        /// <summary>
        /// Loads section from xml
        /// </summary>
        /// <param name="xmlElement"></param>
        public void Load(XmlElement xmlElement)
        {
            // validate name
            xmlElement.ShouldBeNamed(SectionName);

            // validate name of columns collection
            xmlElement.FirstChild.ShouldBeNamed(ColumnsElementName);

            // create column configurations
            _columnConfigurations =
                xmlElement.FirstChild.ChildNodes.OfType<XmlElement>().Select(e => new CsvQueryColumnConfiguration(e)).ToList();
        }
开发者ID:CarlosVV,项目名称:mediavf,代码行数:16,代码来源:CsvQueryConfigurationSection.cs

示例3: YqlPropertyMappingElement

        /// <summary>
        /// Instantiates a <see cref="YqlPropertyMappingElement"/>
        /// </summary>
        /// <param name="xmlElement"></param>
        public YqlPropertyMappingElement(XmlElement xmlElement)
        {
            // validate element
            xmlElement.ShouldBeNamed(PropertyMappingElementName);

            // get attribute values
            _xmlElementName = xmlElement.GetAttributeValue(XmlElementNameAttributeName);
            _propertyName = xmlElement.GetAttributeValue(PropertyNameAttributeName);

            // set enabled, with a default value of false
            bool enabled;
            if (bool.TryParse(xmlElement.GetAttributeValue(EnabledAttributeName, false), out enabled))
                _enabled = enabled;
        }
开发者ID:CarlosVV,项目名称:mediavf,代码行数:18,代码来源:YqlPropertyMappingElement.cs

示例4: GetConstructorParameter

        /// <summary>
        /// Gets a parameter for a constructor from a parameter XmlElement
        /// </summary>
        /// <param name="parameterElement"></param>
        /// <returns></returns>
        private static object GetConstructorParameter(XmlElement parameterElement)
        {
            // ensure element is parameter element
            parameterElement.ShouldBeNamed(ParameterElementName);

            // get flag indicating whether or not to resolve the value of the parameter
            var resolve = parameterElement.GetAttributeValue(ResolveAttributeName).ConvertTo<bool>();

            // get the type of the parameter
            var type = parameterElement.GetTypeFromAttribute(TypeAttributeName);

            // get value to be passed in - if resolving, this is not required
            var value = parameterElement.GetAttributeValue(ValueAttributeName, !resolve);

            // get value for parameter
            return resolve
                ? new ResolvedParameter(type, string.IsNullOrWhiteSpace(value) ? value : null)
                : value.ConvertTo(type);
        }
开发者ID:CarlosVV,项目名称:mediavf,代码行数:24,代码来源:AssemblyConfigurationRegistrations.cs

示例5: CreateRegistration

        /// <summary>
        /// Gets a registration from an xml element
        /// </summary>
        /// <param name="registrationElement"></param>
        /// <returns></returns>
        private static Registration CreateRegistration(XmlElement registrationElement)
        {
            registrationElement.ShouldBeNamed(RegistrationElementName);

            // initialize injection constructor to null
            InjectionConstructor injectionConstructor = null;

            // check for an injection constructor element
            var injectionConstructorElement =
                registrationElement.ChildNodes.OfType<XmlElement>()
                                   .FirstOrDefault(x => x.Name == InjectionConstructorElementName);
            if (injectionConstructorElement != null)
                injectionConstructor = GetInjectionConstructor(injectionConstructorElement);

            return new Registration(registrationElement.GetTypeFromAttribute(RegistrationTypeAttributeName),
                registrationElement.GetTypeFromAttribute(RegistrationMapToAttributeName),
                GetLifetimeManager(registrationElement, RegistrationLifetimeAttributeName),
                registrationElement.GetAttributeValue(RegistrationNameAttributeName, false),
                injectionConstructor);
        }
开发者ID:CarlosVV,项目名称:mediavf,代码行数:25,代码来源:AssemblyConfigurationRegistrations.cs


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