Table of Contents

Interface IValueConverter

Namespace
ToSic.Eav.Data
Assembly
ToSic.Eav.Core.dll

Marks objects that can convert values - like "file:22" to "/images/logo.jpg" and back.

[InternalApi_DoNotUse_MayChangeWithoutNotice]
public interface IValueConverter

Methods

ToReference(string)

Resolve a value to a reference which is managed by the environment

string ToReference(string value)

Parameters

value string

the full value, like "image/logo.jpg"

Returns

string

The reference, like "file:22".

ToValue(string, Guid)

Resolve a reference to a value using the environment resolver

string ToValue(string reference, Guid itemGuid = default)

Parameters

reference string

Reference code (or something else) - if not a code, will not resolve

itemGuid Guid

Guid of the item/entity which was using the reference.
The Guid is used when security setting only allow resolving within the own item. This ensures that external requests cannot just number through all possible IDs.
If you use Guid.Empty or don't supply it, it will usually work, except on systems where the security has been extra-hardened.

Returns

string

The value, like the url.