AddNewtonsoftJsonExceptionResponseFormatter Method
Definition
- Namespace
- Codebelt.Extensions.AspNetCore.Newtonsoft.Json.Formatters
- Assemblies
- Codebelt.Extensions.AspNetCore.Newtonsoft.Json.dll
AddNewtonsoftJsonExceptionResponseFormatter(IServiceCollection, Action<NewtonsoftJsonFormatterOptions>)
Adds an IHttpExceptionDescriptorResponseFormatter that uses NewtonsoftJsonFormatter as engine of serialization to the specified list of services.
public static IServiceCollection AddNewtonsoftJsonExceptionResponseFormatter(this IServiceCollection services, Action<NewtonsoftJsonFormatterOptions> setup = null)
Parameters
servicesIServiceCollectionThe IServiceCollection to extend.
setupAction<NewtonsoftJsonFormatterOptions>The NewtonsoftJsonFormatterOptions which may be configured.
Returns
- IServiceCollection
A reference to
servicesso that additional calls can be chained.
Remarks
Configuration of the NewtonsoftJsonFormatter is done through a call to GetService<T>(IServiceProvider) retrieving an IOptions<TOptions> implementation of NewtonsoftJsonFormatterOptions.
Exceptions
- ArgumentNullException
servicescannot be null