public CollectionData(object collection, Type propertyType, IEnumerable <Attribute> attrs, MementoClassAttribute mementoClassAttr) { Collection = collection; var collectionAttrs = attrs.OfType <MementoCollectionAttribute>().ToList(); //If there are any method-level attributes, use those to decide whether 'cascading' should be performed. if (collectionAttrs.Any()) { Cascade = collectionAttrs.All(a => a.Cascade); } else if (mementoClassAttr != null) //otherwise, use the class-level attribute { Cascade = mementoClassAttr.Cascade; } if (!AdaptIfArray()) { Validate(collectionAttrs, propertyType); } }
public PropertyData(PropertyInfo property, object owner, IEnumerable <Attribute> attrs, MementoClassAttribute mementoClassAttr) : this(property, owner) { var propertiesAttrs = attrs.OfType <MementoPropertyAttribute>().ToList(); //If there are any method-level attributes, use those to decide whether 'cascading' should be performed. if (propertiesAttrs.Any()) { Cascade = propertiesAttrs.All(a => a.Cascade); } else if (mementoClassAttr != null)//otherwise, use the class-level attribute { Cascade = mementoClassAttr.Cascade; } }