Class ValueAssembler
The internal system to create value objects.
[InternalApi_DoNotUse_MayChangeWithoutNotice]
public class ValueAssembler : ServiceWithSetup<DataAssemblerOptions>, IHasLog, IHasOptions<DataAssemblerOptions>, IServiceWithSetup<DataAssemblerOptions>
- Inheritance
-
objectValueAssembler
- Implements
- Inherited Members
Remarks
This is used in the builders to create the values for the attributes. It can also be used by external code to create values, but it's not really meant for that, so it's not public API. It's more of an internal helper class, which is why it's not in the Sys namespace.
Important: everything is functional meaning that object given in will never be modified.
Methods
Bool(bool?, IImmutableList<ILanguage>)
public IValue<bool?> Bool(bool? value, IImmutableList<ILanguage> languages)
Parameters
valuebool?languagesIImmutableList<ILanguage>
Returns
Create(ValueTypes, object?, IImmutableList<ILanguage>?)
Creates a Typed Value Model
public IValue Create(ValueTypes type, object? value, IImmutableList<ILanguage>? languages = null)
Parameters
typeValueTypesvalueobjectlanguagesIImmutableList<ILanguage>
Returns
- IValue
An IValue, which is actually an IValue, IValue, IValue{IEnumerable} etc.
CreateFrom(IValue, NoParamOrder, IImmutableList<ILanguage>?)
Create/clone a value based on an original which will supply most of the values.
public IValue CreateFrom(IValue original, NoParamOrder npo = default, IImmutableList<ILanguage>? languages = null)
Parameters
originalIValuenpoNoParamOrderlanguagesIImmutableList<ILanguage>
Returns
Create<T>(T, IImmutableList<ILanguage>)
Create a basic typed value. This only supports bool, DateTime, number and string. For other types, use the Create with ValueTypes parameter and handle as needed.
public IValue<T> Create<T>(T value, IImmutableList<ILanguage> languages)
Parameters
valueTlanguagesIImmutableList<ILanguage>
Returns
- IValue<T>
Type Parameters
T
DateTime(DateTime?, IImmutableList<ILanguage>)
public IValue<DateTime?> DateTime(DateTime? value, IImmutableList<ILanguage> languages)
Parameters
valueDateTime?languagesIImmutableList<ILanguage>
Returns
GetDefaultOptions()
Method to generate new / default options. This should usually not be called, but it might; so if your service can work without valid options (or accesses options before setup), this would trigger.
This could also be triggered, if the service was created without the correct Generator. Note that it's always an option to just throw an exception.
You must override this to provide your own default options.
protected override DataAssemblerOptions GetDefaultOptions()
Returns
Exceptions
- ServiceOptionsRequiredException
Number(decimal?, IImmutableList<ILanguage>)
public IValue<decimal?> Number(decimal? value, IImmutableList<ILanguage> languages)
Parameters
valuedecimal?languagesIImmutableList<ILanguage>
Returns
String(string?, IImmutableList<ILanguage>)
public IValue<string> String(string? value, IImmutableList<ILanguage> languages)
Parameters
valuestringlanguagesIImmutableList<ILanguage>