public static TBuilder RemoveProperty <TBuilder>(this TBuilder builder, string propertyName)
            where TBuilder : XmlObjectContractBuilder
        {
            if (builder.Properties != null)
            {
                var propertyInfo = XmlPropertyBuilder.GetPropertyInfo(builder.ValueType, propertyName);
                builder.Properties.Remove(propertyInfo);
            }

            return(builder);
        }
        public static XmlObjectContractBuilder <T> RemoveProperty <T, TProperty>(
            this XmlObjectContractBuilder <T> builder,
            Expression <Func <T, TProperty> > expression)
        {
            if (builder.Properties != null)
            {
                var propertyInfo = XmlPropertyBuilder.GetPropertyInfo(expression);
                builder.Properties.Remove(propertyInfo);
            }

            return(builder);
        }
        public static XmlObjectContractBuilder <T> SetProperty <T, TProperty>(
            this XmlObjectContractBuilder <T> builder,
            Expression <Func <T, TProperty> > expression,
            Action <XmlPropertyBuilder> build)
        {
            if (build == null)
            {
                throw new ArgumentNullException("build");
            }

            var property = XmlPropertyBuilder.Create <T, TProperty>(expression);

            build(property);

            if (builder.Properties == null)
            {
                builder.Properties = new XmlPropertyBuilderCollection();
            }

            builder.Properties.Set(property);

            return(builder);
        }
        public static TBuilder SetProperty <TBuilder>(
            this TBuilder builder,
            string propertyName,
            Action <XmlPropertyBuilder> build)
            where TBuilder : XmlObjectContractBuilder
        {
            if (build == null)
            {
                throw new ArgumentNullException("build");
            }

            var property = XmlPropertyBuilder.Create(builder.ValueType, propertyName);

            build(property);

            if (builder.Properties == null)
            {
                builder.Properties = new XmlPropertyBuilderCollection();
            }

            builder.Properties.Set(property);

            return(builder);
        }
Пример #5
0
 public static XmlPropertyBuilder SetKnownType <T>(this XmlPropertyBuilder builder, Action <XmlKnownTypeBuilder> build)
 {
     return(SetKnownType(builder, typeof(T), build));
 }
Пример #6
0
 public static XmlPropertyBuilder SetKnownType <T>(this XmlPropertyBuilder builder, XmlName name = null)
 {
     return(SetKnownType(builder, typeof(T), name));
 }
Пример #7
0
 public static XmlPropertyBuilder SetCollection(this XmlPropertyBuilder builder, bool isCollection = true)
 {
     builder.IsCollection = isCollection;
     return(builder);
 }
Пример #8
0
 public static XmlPropertyBuilder SetRequired(this XmlPropertyBuilder builder, bool isRequired = true)
 {
     builder.IsRequired = isRequired;
     return(builder);
 }
Пример #9
0
 public static XmlPropertyBuilder SetOrder(this XmlPropertyBuilder builder, int order)
 {
     builder.Order = order;
     return(builder);
 }
Пример #10
0
 public static XmlPropertyBuilder SetMappingType(this XmlPropertyBuilder builder, XmlMappingType mappingType)
 {
     builder.MappingType = mappingType;
     return(builder);
 }