Functions, Utilities and Helpers that enable the use of Hypermedia as the Engine of Application State (HATEOAS).
-
Asp.Net Standard/Core Dependency Injection
- Use the provided
services.AddHypermedia(string vendorName) method- The vendorName string is used to build your HATEOAS accepted media type values (e.g. application/vnd.[VENDORNAME].hateoas+json)
- Use the provided
-
Other containers
- Register your supported media types into the relevant output formatters
- Register the Web Api controllers, adding the
ValidateMediaTypeAttributeas a filter; alternatively add [ServiceFilter(typeof(ValidateMediaTypeAttribute))] to your controllers. - Register your output formatters into the container
- Create a mapping class inheriting from
ControllerMap<TController, TReadModel>and in the controller callCreateLinkDefinitionfor all the different HATEOAS links yourTReadModelwill need - Make your
TControllerinherit fromHypermediaControllerBaseand return as normal.OkandCreatedIActionResults will automatically detect the defined links and add them to your response. - NB: If the accept header does not include a valid HATEOAS media type, then the response will not be amended to include the links