Exemplo n.º 1
0
        /// <summary>
        /// Creates a copy of this instance.
        /// </summary>
        public YamlAttributeOverrides Clone()
        {
            var clone = new YamlAttributeOverrides();

            foreach (var entry in overrides)
            {
                foreach (var item in entry.Value)
                {
                    clone.Add(item.RegisteredType, entry.Key.PropertyName, item.Attribute);
                }
            }
            return(clone);
        }
        public YamlAttributeOverrides Clone()
        {
            YamlAttributeOverrides yamlAttributeOverrides = new YamlAttributeOverrides();

            foreach (KeyValuePair <AttributeKey, List <AttributeMapping> > @override in overrides)
            {
                foreach (AttributeMapping item in @override.Value)
                {
                    YamlAttributeOverrides yamlAttributeOverrides2 = yamlAttributeOverrides;
                    Type         registeredType = item.RegisteredType;
                    AttributeKey key            = @override.Key;
                    yamlAttributeOverrides2.Add(registeredType, key.PropertyName, item.Attribute);
                }
            }
            return(yamlAttributeOverrides);
        }
Exemplo n.º 3
0
 public TBuilder WithAttributeOverride(Type type, string member, Attribute attribute)
 {
     overrides.Add(type, member, attribute);
     return(Self);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Register an <see cref="Attribute"/> for a given property.
 /// </summary>
 /// <typeparam name="TClass"></typeparam>
 /// <param name="propertyAccessor">An expression in the form: x => x.SomeProperty</param>
 /// <param name="attribute">The attribute to register.</param>
 /// <returns></returns>
 public TBuilder WithAttributeOverride <TClass>(Expression <Func <TClass, object> > propertyAccessor, Attribute attribute)
 {
     overrides.Add(propertyAccessor, attribute);
     return(Self);
 }