Class DictionaryValueProvider
Values kept per (entity, attribute name), of any value types: one provider
may hold a double attribute and an int attribute. Requesting a
held attribute with another value type throws
AttributeTypeMismatchException; a missing value is null.
public class DictionaryValueProvider : IValueProvider
- Inheritance
-
DictionaryValueProvider
- Implements
- Inherited Members
Constructors
DictionaryValueProvider(IEntityAttributeValueTypeSpecifier)
public DictionaryValueProvider(IEntityAttributeValueTypeSpecifier typeSpecifier)
Parameters
typeSpecifierIEntityAttributeValueTypeSpecifier
Properties
TypeSpecifier
The entities and attributes this provider answers for.
public IEntityAttributeValueTypeSpecifier TypeSpecifier { get; }
Property Value
Methods
Add<V>(IEnumerable<(IEntityIdentifier, IAttribute<V>, V)>)
Adds values; returns this provider for chaining.
public DictionaryValueProvider Add<V>(IEnumerable<(IEntityIdentifier, IAttribute<V>, V)> entries) where V : struct
Parameters
entriesIEnumerable<(IEntityIdentifier, IAttribute<V>, V)>
Returns
Type Parameters
V
Add<V>(IEntityIdentifier, IAttribute<V>, V)
Adds a value; returns this provider for chaining.
public DictionaryValueProvider Add<V>(IEntityIdentifier identifier, IAttribute<V> attribute, V value) where V : struct
Parameters
identifierIEntityIdentifierattributeIAttribute<V>valueV
Returns
Type Parameters
V
GetValue<V>(IEntityIdentifier, IAttribute<V>)
The value of the entity's attribute, or null when there is none.
public V? GetValue<V>(IEntityIdentifier identifier, IAttribute<V> attribute) where V : struct
Parameters
identifierIEntityIdentifierattributeIAttribute<V>
Returns
- V?
Type Parameters
V
Exceptions
- AttributeTypeMismatchException
The provider holds the attribute with another value type.