Table of Contents

Class ModelCreationAttribute

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

BETA / WIP: Attribute to decorate interfaces to specify a concrete type when creating the model.

[AttributeUsage(AttributeTargets.Class|AttributeTargets.Interface, AllowMultiple = false)]
[InternalApi_DoNotUse_MayChangeWithoutNotice]
public sealed class ModelCreationAttribute : Attribute
Inheritance
object
Attribute
ModelCreationAttribute

Examples

[ModelCreation(Use = typeof(PersonModel))]
interface IPersonModel : ICanWrapData
{
  public string Name { get; }
}

Properties

Use

The type to use when creating a model of this interface.

public Type Use { get; init; }

Property Value

Type

Remarks

It must match (implement or inherit) the type which is being decorated. Otherwise, it will throw an exception.