EntityMapper¶
class in JsonApiToolkit.Mapping
Maps entity models to JSON:API resource objects. Caches property information for performance.
Methods¶
GetIdProperty(type: Type)¶
: PropertyInfo
Gets the primary key property for an entity. Searches for: "Id", "{TypeName}Id", or any property ending with "Id".
Parameters
- type
GetAttributeProperties(type: Type)¶
: List<PropertyInfo>
Gets properties to map as JSON:API attributes. Excludes: ID property, relationships, non-public/unreadable properties.
Parameters
- type
GetRelationshipProperties(type: Type)¶
: List<PropertyInfo>
Gets properties to map as JSON:API relationships. Includes collections and complex objects that have ID properties. Excludes primitives, value types, strings, DateTime, Guid, and owned entities without IDs.
Parameters
- type
GetResourceType(type: Type, useAttributeTypeName: bool)¶
: string
Gets the JSON:API resource type name. Default: entity class name in camelCase (e.g. "Person" becomes "person"). When useAttributeTypeName is true and the type carries JsonApiResourceAttribute, its declared wire type is used instead.
Parameters
- type
- useAttributeTypeName
GetAttributeName(property: PropertyInfo)¶
: string
Gets the JSON:API attribute name for a property. Centralizes name resolution so that the serializer and projection field matching always use the same logic and cannot silently diverge.
Parameters
- property