ServiceCollectionExtensions Class
Definition
- Namespace
- Cuemon.Extensions.AspNetCore.Xml.Formatters
- Assemblies
- Cuemon.Extensions.AspNetCore.Xml.dll
Extension methods for the IServiceCollection interface.
public static class ServiceCollectionExtensions
- Inheritance
-
ServiceCollectionExtensions
Examples
The following example demonstrates how to register XML formatter options and an XML-based exception response formatter in the ASP.NET Core service collection.
using Cuemon.Extensions.AspNetCore.Xml.Formatters;
using Microsoft.Extensions.DependencyInjection;
namespace MyApp.Examples;
public class XmlFormattersServiceCollectionExtensionsExample
{
public void ConfigureServices(IServiceCollection services)
{
services.AddXmlFormatterOptions(options =>
{
options.SynchronizeWithXmlConvert = true;
});
services.AddXmlExceptionResponseFormatter();
}
}
Methods
| Name | Description |
|---|---|
| AddXmlExceptionResponseFormatter(IServiceCollection, Action<XmlFormatterOptions>) | Adds an IHttpExceptionDescriptorResponseFormatter that uses XmlFormatter as engine of serialization to the specified list of |
| AddXmlFormatterOptions(IServiceCollection, Action<XmlFormatterOptions>) | Adds configuration of XmlFormatterOptions for the application. |