Class ServiceCollectionExtensions
- Assembly
- Cuemon.Extensions.AspNetCore.Xml.dll
Extension methods for the IServiceCollection interface.
public static class ServiceCollectionExtensions
- Inheritance
-
ServiceCollectionExtensions
Methods
AddXmlExceptionResponseFormatter(IServiceCollection, Action<XmlFormatterOptions>)
Adds an IHttpExceptionDescriptorResponseFormatter that uses XmlFormatter as engine of serialization to the specified list of services
.
public static IServiceCollection AddXmlExceptionResponseFormatter(this IServiceCollection services, Action<XmlFormatterOptions> setup = null)
Parameters
services
IServiceCollectionThe IServiceCollection to extend.
setup
Action<XmlFormatterOptions>The XmlFormatterOptions which may be configured.
Returns
- IServiceCollection
A reference to
services
so that additional calls can be chained.
Remarks
Configuration of the XmlFormatter is done through a call to GetService<T>(IServiceProvider) retrieving an IOptions<TOptions> implementation of XmlFormatterOptions.
Exceptions
- ArgumentNullException
services
cannot be null
AddXmlFormatterOptions(IServiceCollection, Action<XmlFormatterOptions>)
Adds configuration of XmlFormatterOptions for the application.
public static IServiceCollection AddXmlFormatterOptions(this IServiceCollection services, Action<XmlFormatterOptions> setup = null)
Parameters
services
IServiceCollectionThe IServiceCollection to extend.
setup
Action<XmlFormatterOptions>The XmlFormatterOptions 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 XmlFormatterOptions in a valid state.