Skip to content

OptionsModel

public sealed class OptionsModel

Namespace: RhoMicro.BindSight.Models

Inheritance:

Represents an options registration.

OptionsModel(OptionsModelRoot, ImmutableHashSet<OptionsModelChild>, EnrichmentFactory)
Section titled “OptionsModel(OptionsModelRoot, ImmutableHashSet<OptionsModelChild>, EnrichmentFactory)”
public OptionsModel(OptionsModelRoot root, ImmutableHashSet<OptionsModelChild> children, EnrichmentFactory enrichmentFactory)

Initializes a new instance.

NameTypeDescription
childrenImmutableHashSet<OptionsModelChild>The models of bound object graphs defined by root properties.
enrichmentFactoryEnrichmentFactoryThe factory used to create enrichments to the new model instance.
rootOptionsModelRootThe model of the registered options type.
OptionsModel(OptionsModelRoot, EnrichmentFactory)
Section titled “OptionsModel(OptionsModelRoot, EnrichmentFactory)”
public OptionsModel(OptionsModelRoot root, EnrichmentFactory enrichmentFactory)

Initializes a new instance.

NameTypeDescription
enrichmentFactoryEnrichmentFactoryThe factory used to create enrichments to the new model instance.
rootOptionsModelRootThe model of the registered options type.
OptionsModel(OptionsModelRoot, ImmutableHashSet<OptionsModelChild>, EnrichmentFactory, ConcurrentDictionary<Type, object>)
Section titled “OptionsModel(OptionsModelRoot, ImmutableHashSet<OptionsModelChild>, EnrichmentFactory, ConcurrentDictionary<Type, object>)”
private OptionsModel(OptionsModelRoot root, ImmutableHashSet<OptionsModelChild>? children, EnrichmentFactory enrichmentFactory, ConcurrentDictionary<Type, object> enrichments)
public OptionsModelRoot Root { get; }

Gets the model of the registered options type.

public ImmutableHashSet<OptionsModelChild> Children { get; }

Gets the models of bound object graphs defined by root properties.

public OptionsModel WithRoot(OptionsModelRoot root)

Creates a copy of this instance with OptionsModel.Root replaced.

NameTypeDescription
rootOptionsModelRootThe value to replace OptionsModel.Root with.

A copy of this instance with OptionsModel.Root replaced by root.

WithChildren(ImmutableHashSet<OptionsModelChild>)
Section titled “WithChildren(ImmutableHashSet<OptionsModelChild>)”
public OptionsModel WithChildren(ImmutableHashSet<OptionsModelChild> children)

Creates a copy of this instance with OptionsModel.Children replaced.

NameTypeDescription
childrenImmutableHashSet<OptionsModelChild>The value to replace OptionsModel.Children with.

A copy of this instance with OptionsModel.Children replaced by children.

public TEnrichment GetEnrichment<TEnrichment>() where TEnrichment : IOptionsModelEnrichment<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.IOptionsModelEnrichment<TEnrichment>

The instance of TEnrichment attached to this instance.

public OptionsModel WithEnrichment<TEnrichment>(TEnrichment enrichment) where TEnrichment : IOptionsModelEnrichment<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.IOptionsModelEnrichment<TEnrichment>
NameTypeDescription
enrichmentTEnrichmentThe enrichment to attach to the returned copy.

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

public static OptionsModel Create(Type type, EnrichmentFactory enrichmentFactory)

Creates a new instance using default creation options.

NameTypeDescription
enrichmentFactoryEnrichmentFactoryThe enrichment factory to be used by the created instance when creating enrichments.
typeTypeThe options type to model.

A new model of the options type.

Create(Type, EnrichmentFactory, OptionsModelCreationOptions)
Section titled “Create(Type, EnrichmentFactory, OptionsModelCreationOptions)”
public static OptionsModel Create(Type type, EnrichmentFactory enrichmentFactory, OptionsModelCreationOptions options)

Creates a new instance.

NameTypeDescription
enrichmentFactoryEnrichmentFactoryThe enrichment factory to be used by the created instance when creating enrichments.
optionsOptionsModelCreationOptionsThe options to use when creating the model.
typeTypeThe options type to model.

A new model of the options type.

public override string ToString()

Returns a string that represents the current object.

A string that represents the current object.

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 bool Equals(OptionsModel? other)
public override int GetHashCode()

Serves as the default hash function.

A hash code for the current object.