Class ServiceCollectionExtensions
- Namespace
- Codebelt.Extensions.AspNetCore.Text.Yaml.Formatters
- Assembly
- Codebelt.Extensions.AspNetCore.Text.Yaml.dll
Extension methods for the IServiceCollection interface.
public static class ServiceCollectionExtensions
- Inheritance
-
ServiceCollectionExtensions
Methods
AddYamlExceptionResponseFormatter(IServiceCollection, Action<YamlFormatterOptions>)
Adds an IHttpExceptionDescriptorResponseFormatter that uses YamlFormatter as engine of serialization to the specified list of services
.
public static IServiceCollection AddYamlExceptionResponseFormatter(this IServiceCollection services, Action<YamlFormatterOptions> setup = null)
Parameters
services
IServiceCollectionThe IServiceCollection to extend.
setup
Action<YamlFormatterOptions>The YamlFormatterOptions which may be configured.
Returns
- IServiceCollection
A reference to
services
so that additional calls can be chained.
Remarks
Configuration of the YamlFormatter is done through a call to GetService<T>(IServiceProvider) retrieving an IOptions<TOptions> implementation of YamlFormatterOptions.
Exceptions
- ArgumentNullException
services
cannot be null
AddYamlFormatterOptions(IServiceCollection, Action<YamlFormatterOptions>)
Adds configuration of YamlFormatterOptions for the application.
public static IServiceCollection AddYamlFormatterOptions(this IServiceCollection services, Action<YamlFormatterOptions> setup = null)
Parameters
services
IServiceCollectionThe IServiceCollection to extend.
setup
Action<YamlFormatterOptions>The YamlFormatterOptions which may be configured.
Returns
- IServiceCollection
A reference to
services
so that additional configuration calls can be chained.
Exceptions
- ArgumentNullException
services
cannot be null.