Class AttrAttribute
- Namespace
- JsonApiDotNetCore.Resources.Annotations
- Assembly
- JsonApiDotNetCore.Annotations.dll
Used to expose a property on a resource class as a JSON:API attribute (https://jsonapi.org/format/#document-resource-object-attributes).
[PublicAPI]
[AttributeUsage(AttributeTargets.Property)]
public sealed class AttrAttribute : ResourceFieldAttribute
- Inheritance
-
AttrAttribute
- Inherited Members
Properties
Capabilities
The set of allowed capabilities on this attribute. When not explicitly set, the configured default set of capabilities is used.
public AttrCapabilities Capabilities { get; set; }
Property Value
Examples
public class Author : Identifiable<long>
{
[Attr(Capabilities = AttrCapabilities.AllowFilter | AttrCapabilities.AllowSort)]
public string Name { get; set; } = null!;
}
Methods
Equals(object?)
Returns a value that indicates whether this instance is equal to a specified object.
public override bool Equals(object? obj)
Parameters
Returns
- bool
true if
obj
and this instance are of the same type and have identical field values; otherwise, false.
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer hash code.