Table of Contents

Class ValueAssembler

Namespace
ToSic.Eav.Data.Build.Sys
Assembly
ToSic.Eav.Data.Build.dll

The internal system to create value objects.

[InternalApi_DoNotUse_MayChangeWithoutNotice]
public class ValueAssembler : ServiceWithSetup<DataAssemblerOptions>, IHasLog, IHasOptions<DataAssemblerOptions>, IServiceWithSetup<DataAssemblerOptions>
Inheritance
object
ValueAssembler
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

value bool?
languages IImmutableList<ILanguage>

Returns

IValue<bool?>

Create(ValueTypes, object?, IImmutableList<ILanguage>?)

Creates a Typed Value Model

public IValue Create(ValueTypes type, object? value, IImmutableList<ILanguage>? languages = null)

Parameters

type ValueTypes
value object
languages IImmutableList<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

original IValue
npo NoParamOrder
languages IImmutableList<ILanguage>

Returns

IValue

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

value T
languages IImmutableList<ILanguage>

Returns

IValue<T>

Type Parameters

T

DateTime(DateTime?, IImmutableList<ILanguage>)

public IValue<DateTime?> DateTime(DateTime? value, IImmutableList<ILanguage> languages)

Parameters

value DateTime?
languages IImmutableList<ILanguage>

Returns

IValue<DateTime?>

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

DataAssemblerOptions

Exceptions

ServiceOptionsRequiredException

Number(decimal?, IImmutableList<ILanguage>)

public IValue<decimal?> Number(decimal? value, IImmutableList<ILanguage> languages)

Parameters

value decimal?
languages IImmutableList<ILanguage>

Returns

IValue<decimal?>

String(string?, IImmutableList<ILanguage>)

public IValue<string> String(string? value, IImmutableList<ILanguage> languages)

Parameters

value string
languages IImmutableList<ILanguage>

Returns

IValue<string>