Class ServiceCollectionExtensions
- Assembly
- Codebelt.Extensions.AspNetCore.Text.Yaml.dll
Extension methods for the Microsoft.Extensions.DependencyInjection.IServiceCollection interface.
public static class ServiceCollectionExtensions
- Inheritance
-
ObjectServiceCollectionExtensions
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 Microsoft.Extensions.DependencyInjection.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 Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService``1(System.IServiceProvider) retrieving an Microsoft.Extensions.Options.IOptions<TOptions> implementation of YamlFormatterOptions.
Exceptions
- System.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 Microsoft.Extensions.DependencyInjection.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
- System.ArgumentNullException
services
cannot be null.