Skip to content

Commit 1439ea8

Browse files
committed
Introduced special ModelType.Reflexive enum value
The `Reflexive` value instructs callers of an `AttributeDescriptor` to gets its `ModelType` from the `AttributeDescriptor.ModelType` of the `AttributeDescriptor` derivative that the `AttributeDescriptor` is placed on. This is a special scenario which allows e.g. the OnTopic Editor to display an attribute on an `AttributeDescriptor` which uses the current topic's values, and stores the result in the same location as the current topic. This is useful for e.g. `AttributeDescriptor.DefaultValue`, which should be set to use the same attribute type and storage location as the `AttributeDescriptor` it is set for (OnTopicCMS/OnTopic-Editor-AspNetCore#44).
1 parent d936bcb commit 1439ea8

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)