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); }
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); }