Interface IModelSetup<TSource>
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
TSourceThe 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
sourceTSource
Returns
- bool
trueif all is ok,falseif not. A typical example would be a wrapper which is setup withnulland it cannot work that way. On the other hand, if a wrapper is ok with a null source, it would returntrue.