Table of Contents

Class ServiceCollectionExtensions

Namespace
Cuemon.Extensions.AspNetCore.Text.Json.Formatters
Assembly
Cuemon.Extensions.AspNetCore.Text.Json.dll

Extension methods for the IServiceCollection interface.

public static class ServiceCollectionExtensions
Inheritance
ServiceCollectionExtensions

Methods

AddJsonExceptionResponseFormatter(IServiceCollection, Action<JsonFormatterOptions>)

Adds an IHttpExceptionDescriptorResponseFormatter that uses JsonFormatter as engine of serialization to the specified list of services.

public static IServiceCollection AddJsonExceptionResponseFormatter(this IServiceCollection services, Action<JsonFormatterOptions> setup = null)

Parameters

services IServiceCollection

The IServiceCollection to extend.

setup Action<JsonFormatterOptions>

The JsonFormatterOptions which may be configured.

Returns

IServiceCollection

A reference to services so that additional calls can be chained.

Remarks

Configuration of the JsonFormatter is done through a call to GetService<T>(IServiceProvider) retrieving an IOptions<TOptions> implementation of JsonFormatterOptions.

Exceptions

ArgumentNullException

services cannot be null

AddJsonFormatterOptions(IServiceCollection, Action<JsonFormatterOptions>)

Adds configuration of JsonFormatterOptions for the application.

public static IServiceCollection AddJsonFormatterOptions(this IServiceCollection services, Action<JsonFormatterOptions> setup = null)

Parameters

services IServiceCollection

The IServiceCollection to extend.

setup Action<JsonFormatterOptions>

The JsonFormatterOptions which may be configured.

Returns

IServiceCollection

A reference to services so that additional configuration calls can be chained.

Exceptions

ArgumentNullException

services cannot be null.

ArgumentException

setup failed to configure an instance of JsonFormatterOptions in a valid state.