Class ResourceAttribute
- Namespace
- JsonApiDotNetCore.Resources.Annotations
- Assembly
- JsonApiDotNetCore.Annotations.dll
When put on a resource class, overrides the convention-based public resource name and auto-generates an ASP.NET controller.
[PublicAPI]
[AttributeUsage(AttributeTargets.Class|AttributeTargets.Struct)]
public sealed class ResourceAttribute : Attribute
- Inheritance
-
ResourceAttribute
- Inherited Members
Properties
ClientIdGeneration
Optional. Whether API clients are allowed or required to provide IDs when creating resources of this type. When not set, the value from global options applies.
public ClientIdGenerationMode ClientIdGeneration { get; set; }
Property Value
ControllerNamespace
Optional. The full namespace in which to auto-generate the ASP.NET controller. Defaults to the sibling namespace "Controllers". For example, a resource class that is declared in namespace "ExampleCompany.ExampleApi.Models" will use "ExampleCompany.ExampleApi.Controllers" by default.
public string? ControllerNamespace { get; set; }
Property Value
GenerateControllerEndpoints
The set of endpoints to auto-generate an ASP.NET controller for. Defaults to All. Set to None to disable controller generation.
public JsonApiEndpoints GenerateControllerEndpoints { get; set; }
Property Value
PublicName
Optional. The publicly exposed name of this resource type.
public string? PublicName { get; set; }