Skip to content

Commit dc6b8ad

Browse files
committed
Merge branch 'improvement/ModelType-reflexive' into develop
Introduced a special `ModelType.Reflexive` enum value in order to support the proposed `ReflexiveAttribute` plugin for the OnTopic Editor (OnTopicCMS/OnTopic-Editor-AspNetCore#44), which allows an attribute placed on an `AttributeDescriptor` to "reflect" back that `AttributeDescriptor` as an attribute, thus allowing e.g. `AttributeDescriptor.DefaultValue` to use the same values as the `AttributeDescriptor` it describes, including the same storage location, as described by its `AttributeDescriptor.ModelType`. It does this by falling back to the `ModelType` of the current topic when the `ModelType` of an `AttributeDescriptor` on its `ContentTypeDescriptor` is set to `Reflexive`.
2 parents d936bcb + 1439ea8 commit dc6b8ad

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

OnTopic/Metadata/ModelType.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,21 @@ public enum ModelType {
5555
/// <summary>
5656
/// A set of child <see cref="Topic"/>s packaged as part of the current <see cref="Topic"/>.
5757
/// </summary>
58-
NestedTopic = 4
58+
NestedTopic = 4,
59+
60+
/*--------------------------------------------------------------------------------------------------------------------------
61+
| REFLEXIVE
62+
\-------------------------------------------------------------------------------------------------------------------------*/
63+
/// <summary>
64+
/// A special value for <see cref="AttributeDescriptor"/>s placed on <see cref="AttributeDescriptor"/>s, which specifies
65+
/// that the <see cref="ModelType"/> should be inherited from the <see cref="AttributeDescriptor.ModelType"/>.
66+
/// </summary>
67+
/// <remarks>
68+
/// This is useful for implementing an <see cref="AttributeDescriptor"/> which reflects the <see cref="AttributeDescriptor
69+
/// "/> it is placed on. For example, the <see cref="AttributeDescriptor.DefaultValue"/> attribute should store the value
70+
/// in the same location as the <see cref="AttributeDescriptor"/> for which it's setting.
71+
/// </remarks>
72+
Reflexive = 5
5973

6074
} //Enum
6175
} //Namespace

0 commit comments

Comments
 (0)