Table of Contents

Interface IModelSetup<TSource>

Namespace
ToSic.Eav.Models
Assembly
ToSic.Eav.Data.dll

Marks objects such as custom items or data models, which can receive a specific data-type (entity or typed item) and wrap it.

[InternalApi_DoNotUse_MayChangeWithoutNotice("may change or rename at any time")]
public interface IModelSetup<in TSource>

Type Parameters

TSource

The data type which can be accepted. Must be IEntity or ITypedItem (other types not supported for now).

Remarks

This is more specific than the ICanWrapData, since that is just a marker interface. This one specifies that the object has the necessary Setup() method to receive the data of the expected type.

Typical use is for custom data such as classes inheriting from CustomItem which takes an entity and then provides a strongly typed wrapper around it.

History

  • Introduced in v21
  • NOT visible in the docs for better understanding in v21
  • The Setup() method is still internal, as the signature may still change

Methods

SetupModel(TSource?)

Add the contents to use for the wrapper. We are not doing this in the constructor, because the object needs to have an empty or DI-compatible constructor.

bool SetupModel(TSource? source)

Parameters

source TSource

Returns

bool

true if all is ok, false if not. A typical example would be a wrapper which is setup with null and it cannot work that way. On the other hand, if a wrapper is ok with a null source, it would return true.