コード例 #1
0
        public static XmlAttributeConfiguration HasAttribute <T>(this XmlComplexTypeConfiguration <T> configuration, Expression <Func <T, byte> > property)
            where T : class
        {
            var propertyInfo    = ReflectionHelpers.GetPropertyInfo(property);
            var attributeConfig = new XmlAttributeConfiguration(propertyInfo);

            configuration.PropertyConfigurations.Add(attributeConfig);

            return(attributeConfig);
        }
コード例 #2
0
        public static XmlAttributeConfiguration HasAttribute <T>(this XmlComplexTypeConfiguration <T> configuration, Expression <Func <T, Nullable <byte> > > property)
            where T : class
        {
            var propertyInfo      = ReflectionHelpers.GetPropertyInfo(property);
            var convertToString   = ReflectionHelpers.GetDelegateMethodInfo <Nullable <byte>, string>(StringConversions.ConvertByteToString);
            var convertFromString = ReflectionHelpers.GetDelegateMethodInfo <string, Nullable <byte> >(StringConversions.ConvertStringToByte);
            var attributeConfig   = new XmlAttributeConfiguration(propertyInfo, typeof(string), convertFromString, convertToString);

            configuration.PropertyConfigurations.Add(attributeConfig);

            return(attributeConfig);
        }