Skip to content

OptionsModelRoot

public sealed class OptionsModelRoot

Namespace: RhoMicro.BindSight.Models

Inheritance:

Models a registered option type.

public OptionsModelRoot(Type type, EnrichmentFactory enrichmentFactory)

Initializes a new instance.

NameTypeDescription
enrichmentFactoryEnrichmentFactoryThe enrichment factory to use when creating enrichments.
typeTypeThe modelled options type.
OptionsModelRoot(Type, EnrichmentFactory, ConcurrentDictionary<Type, object>)
Section titled “OptionsModelRoot(Type, EnrichmentFactory, ConcurrentDictionary<Type, object>)”
private OptionsModelRoot(Type type, EnrichmentFactory enrichmentFactory, ConcurrentDictionary<Type, object> enrichments)
public Type Type { get; }

Gets the modelled type.

public TEnrichment GetEnrichment<TEnrichment>() where TEnrichment : IOptionsModelRootEnrichment<TEnrichment>

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.

NameDescriptionConstraints
TEnrichmentThe type of enrichment to get.IOptionsModelRootEnrichment<TEnrichment>

The instance of TEnrichment attached to this instance.

public OptionsModelRoot WithEnrichment<TEnrichment>(TEnrichment enrichment) where TEnrichment : IOptionsModelRootEnrichment<TEnrichment>

Gets a copy of this instance with the specified type of enrichment replaced.

NameDescriptionConstraints
TEnrichmentThe type of enrichment to attach to the returned copy.IOptionsModelRootEnrichment<TEnrichment>
NameTypeDescription
enrichmentTEnrichmentThe enrichment to attach to the returned copy.

A copy of this instance with the TEnrichment replaced by enrichment.

public override string ToString()

Returns a string that represents the current object.

A string that represents the current object.

public bool Equals(OptionsModelRoot? other)
public override bool Equals(object? obj)

Determines whether the specified object is equal to the current object.

NameTypeDescription
objObjectThe object to compare with the current object.

true if the specified object is equal to the current object; otherwise, false.

public override int GetHashCode()

Serves as the default hash function.

A hash code for the current object.