Table of Contents

Interface ICanWrapData

Namespace
ToSic.Sxc.Data
Assembly
ToSic.Sxc.dll

Marks objects such as custom items or data models, which can wrap data (usually Entities or TypedItems).

[InternalApi_DoNotUse_MayChangeWithoutNotice("may change or rename at any time")]
public interface ICanWrapData

Remarks

Most 2sxc base classes such as Razor files or WebApi files have some methods which will return a typed data model. This is usually As<TModel>() or AsList<TModel>(). To help the developer understand what is allowed for TModel we must mark all objects which are supported, and this is done with this interface.

So any class which is meant to wrap data from an IEntity or ITypedItem should implement this interface. 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

  • Made visible in the docs for better understanding in v19.01