PostSharpAPI ReferencePost­Sharp.​Patterns.​ModelChild­AttributeIs­Parent­Surrogate
Open sandboxFocus

ChildAttribute.IsParentSurrogate Property

IsParentSurrogate

Determines whether the value assigned to the field or property is a parent surrogate. The Parent property of children of a parent surrogate are set to the parent of the parent surrogate, instead of to the field itself.

Declaration
public bool IsParentSurrogate { get; set; }
Property Value
Type Description
Boolean
Remarks

When an item is attached to a parent surrogate, the Parent property of the item is set to the Parent of the parent surrogate, instead of the parent surrogate itself. Collections are typical examples of a parent surrogate, because the parent of collection items need to be the owner of the collection and not the collection itself.

The default value of this field is true for collections, and false otherwise.