Table of Contents

Struct ConvertedFieldValue

Namespace
Dynamicweb.Ecommerce.Feeds
Assembly
Dynamicweb.Ecommerce.dll

A numeric product field value that carries a unit symbol, as produced by a field value conversion (see FieldValueConversionService) or by a field type provider that appends a unit to the value.

public readonly record struct ConvertedFieldValue : IFormattable, IEquatable<ConvertedFieldValue>
Implements
Inherited Members

Remarks

The product view model exposes such a value as text that has already been rendered in the culture the server happened to be running in, which makes it the odd one out in a feed: every other numeric column is formatted in the culture of the language the feed is exported for. Data mapping feed providers therefore split that text back into its two parts, so the number can be re-formatted for the feed while the unit symbol is carried along unchanged.

Constructors

ConvertedFieldValue(double, string?)

A numeric product field value that carries a unit symbol, as produced by a field value conversion (see FieldValueConversionService) or by a field type provider that appends a unit to the value.

public ConvertedFieldValue(double Number, string? Unit)

Parameters

Number double

The numeric part of the value, expressed in Unit.

Unit string

The unit symbol (e.g. "kg", "mm"), or null when the value carries none.

Remarks

The product view model exposes such a value as text that has already been rendered in the culture the server happened to be running in, which makes it the odd one out in a feed: every other numeric column is formatted in the culture of the language the feed is exported for. Data mapping feed providers therefore split that text back into its two parts, so the number can be re-formatted for the feed while the unit symbol is carried along unchanged.

Properties

Number

The numeric part of the value, expressed in Unit.

public double Number { get; init; }

Property Value

double

Unit

The unit symbol (e.g. "kg", "mm"), or null when the value carries none.

public string? Unit { get; init; }

Property Value

string

Methods

ToString()

Renders the value invariantly. Declared so that a caller which treats the value as a plain object - as every caller of the data mapping row values did before this type existed - still gets readable text instead of the record's default member listing.

public override string ToString()

Returns

string

ToString(string?, IFormatProvider?)

Renders the value as "number unit" - or as the bare number when it carries no unit - with the number formatted for formatProvider. Pass the culture of the language the feed is exported for; passing null renders invariant.

public string ToString(string? format, IFormatProvider? formatProvider)

Parameters

format string

The numeric format for the number part, or null for the format feed providers use.

formatProvider IFormatProvider

The format provider for the number part, or null for InvariantCulture.

Returns

string
To top