OptionsModelChild
public sealed class OptionsModelChild
Namespace: RhoMicro.BindSight.Models
Inheritance:
Summary
Section titled “Summary”Models a direct or indirect property or generic argument of a registered options type.
Constructors
Section titled “Constructors”OptionsModelChild(PropertyInfo, OptionsModel, OptionsModelChild, EnrichmentFactory)
Section titled “OptionsModelChild(PropertyInfo, OptionsModel, OptionsModelChild, EnrichmentFactory)”public OptionsModelChild(PropertyInfo property, OptionsModel model, OptionsModelChild? parent, EnrichmentFactory enrichmentFactory)
Summary
Section titled “Summary”Initializes a new instance.
Parameters
Section titled “Parameters”Name | Type | Description |
---|---|---|
enrichmentFactory | EnrichmentFactory | The factory used to create enrichments to the new model instance. |
model | OptionsModel | The model containing the root to this property. |
parent | OptionsModelChild | The parent to this child. |
property | PropertyInfo | The property to model. |
OptionsModelChild(Type, OptionsModel, OptionsModelChild, EnrichmentFactory)
Section titled “OptionsModelChild(Type, OptionsModel, OptionsModelChild, EnrichmentFactory)”public OptionsModelChild(Type genericArgumentType, OptionsModel model, OptionsModelChild? parent, EnrichmentFactory enrichmentFactory)
Summary
Section titled “Summary”Initializes a new instance.
Parameters
Section titled “Parameters”Name | Type | Description |
---|---|---|
enrichmentFactory | EnrichmentFactory | The factory used to create enrichments to the new model instance. |
genericArgumentType | Type | The generic argument type to model. |
model | OptionsModel | The model containing the root to this property. |
parent | OptionsModelChild | The parent to this child. |
OptionsModelChild(ConcurrentDictionary<Type, object>, EnrichmentFactory, PropertyInfo, Type, OptionsModelChild, OptionsModel)
Section titled “OptionsModelChild(ConcurrentDictionary<Type, object>, EnrichmentFactory, PropertyInfo, Type, OptionsModelChild, OptionsModel)”private OptionsModelChild(ConcurrentDictionary<Type, object> enrichments, EnrichmentFactory enrichmentFactory, PropertyInfo? property, Type? genericArgumentType, OptionsModelChild? parent, OptionsModel model)
Properties
Section titled “Properties”Property
Section titled “Property”public PropertyInfo? Property { get; }
Summary
Section titled “Summary”Gets the property info modelled by this instance, if it is modelling one; otherwise, null
.
GenericArgumentType
Section titled “GenericArgumentType”public Type? GenericArgumentType { get; }
Summary
Section titled “Summary”Gets the generic type argument modelled by this instance, if it is modelling one; otherwise, null
.
Parent
Section titled “Parent”public OptionsModelChild? Parent { get; }
Summary
Section titled “Summary”Gets the parent containing this model if it is contained in one; otherwise, null
.
public OptionsModel Model { get; }
Summary
Section titled “Summary”Gets the options model containing the root defining this child.
ModelledType
Section titled “ModelledType”public Type ModelledType { get; }
Summary
Section titled “Summary”Gets the type of the modelled property or the modelled type.
Methods
Section titled “Methods”GetFirstCustomAttribute<TAttribute>(bool)
Section titled “GetFirstCustomAttribute<TAttribute>(bool)”public TAttribute? GetFirstCustomAttribute<TAttribute>([bool inherit = false]) where TAttribute : Attribute
Summary
Section titled “Summary”Gets the first found custom attribute of type TAttributeon either OptionsModelChild.Property or OptionsModelChild.GenericArgumentType, depending on which is being modelled by this instance.
Type Parameters
Section titled “Type Parameters”Name | Description | Constraints |
---|---|---|
T | The type of attribute to search for. | |
TAttribute | The type of attribute to look for. | Attribute |
Parameters
Section titled “Parameters”Name | Type | Description |
---|---|---|
element | The member to inspect. | |
inherit | Boolean | true to inspect the ancestors of element ; otherwise, false . |
Returns
Section titled “Returns”The first found attribute of type TAttribute, if one could be found; otherwise, null
.
Exceptions
Section titled “Exceptions”####### TypeLoadException
A custom attribute type cannot be loaded.####### AmbiguousMatchException
More than one of the requested attributes was found.####### NotSupportedException
element
is not a constructor, method, property, event, type, or field.####### ArgumentNullException
element
is null
.
GetCustomAttributes<TAttribute>(bool)
Section titled “GetCustomAttributes<TAttribute>(bool)”public ImmutableArray<TAttribute> GetCustomAttributes<TAttribute>([bool inherit = false]) where TAttribute : Attribute
Summary
Section titled “Summary”Gets all custom attribute of type TAttributeon either OptionsModelChild.Property or OptionsModelChild.GenericArgumentType, depending on which is being modelled by this instance.
Type Parameters
Section titled “Type Parameters”Name | Description | Constraints |
---|---|---|
T | The type of attribute to search for. | |
TAttribute | The type of attribute to look for. | Attribute |
Parameters
Section titled “Parameters”Name | Type | Description |
---|---|---|
element | The member to inspect. | |
inherit | Boolean | true to inspect the ancestors of element ; otherwise, false . |
Returns
Section titled “Returns”All attributes of type TAttribute, if one could be found; otherwise, null
.
Exceptions
Section titled “Exceptions”####### TypeLoadException
A custom attribute type cannot be loaded.####### AmbiguousMatchException
More than one of the requested attributes was found.####### NotSupportedException
element
is not a constructor, method, property, event, type, or field.####### ArgumentNullException
element
is null
.
GetEnrichment<TEnrichment>()
Section titled “GetEnrichment<TEnrichment>()”public TEnrichment GetEnrichment<TEnrichment>() where TEnrichment : notnull, IOptionsModelChildEnrichment<TEnrichment>
Summary
Section titled “Summary”Gets an instance of the specified enrichment type. If an instance of the enrichment type is already attached to this instance, it is returned; otherwise, a new instance of the enrichment will be created and attached to this instance.
Type Parameters
Section titled “Type Parameters”Name | Description | Constraints |
---|---|---|
TEnrichment | The type of enrichment to get. | notnull , IOptionsModelChildEnrichment<TEnrichment> |
Returns
Section titled “Returns”The instance of TEnrichment attached to this instance.
WithEnrichment<TEnrichment>(TEnrichment)
Section titled “WithEnrichment<TEnrichment>(TEnrichment)”public OptionsModelChild WithEnrichment<TEnrichment>(TEnrichment enrichment) where TEnrichment : IOptionsModelChildEnrichment<TEnrichment>
Summary
Section titled “Summary”Gets a copy of this instance with the specified type of enrichment replaced.
Type Parameters
Section titled “Type Parameters”Name | Description | Constraints |
---|---|---|
TEnrichment | The type of enrichment to attach to the returned copy. | IOptionsModelChildEnrichment<TEnrichment> |
Parameters
Section titled “Parameters”Name | Type | Description |
---|---|---|
enrichment | TEnrichment | The enrichment to attach to the returned copy. |
Returns
Section titled “Returns”A copy of this instance with the TEnrichment replaced by enrichment.
GetHashCode()
Section titled “GetHashCode()”public override int GetHashCode()
Summary
Section titled “Summary”Serves as the default hash function.
Returns
Section titled “Returns”A hash code for the current object.
Equals(object)
Section titled “Equals(object)”public override bool Equals(object? obj)
Summary
Section titled “Summary”Determines whether the specified object is equal to the current object.
Parameters
Section titled “Parameters”Name | Type | Description |
---|---|---|
obj | Object | The object to compare with the current object. |
Returns
Section titled “Returns”true
if the specified object is equal to the current object; otherwise, false
.
Equals(OptionsModelChild)
Section titled “Equals(OptionsModelChild)”public bool Equals(OptionsModelChild? other)