MvcCoreBuilderExtensions Class
Definition
- Namespace
- Cuemon.Extensions.AspNetCore.Mvc.Formatters.Xml
- Assemblies
- Cuemon.Extensions.AspNetCore.Mvc.Formatters.Xml.dll
Extension methods for the IMvcCoreBuilder interface.
public static class MvcCoreBuilderExtensions
- Inheritance
-
objectMvcCoreBuilderExtensions
Examples
The following example demonstrates how to add XML serialization formatters to an MVC core builder using the extension methods.
using Cuemon.Extensions.AspNetCore.Mvc.Formatters.Xml;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
namespace MyApp.Examples;
public class MvcCoreBuilderExtensionsExample
{
public void ConfigureMvc(IMvcCoreBuilder builder)
{
// Invoke the AddXmlFormatters extension method
builder.AddXmlFormatters(options =>
{
options.SynchronizeWithXmlConvert = true;
});
// Invoke the AddXmlFormattersOptions extension method
builder.AddXmlFormattersOptions(options =>
{
options.SynchronizeWithXmlConvert = true;
});
}
}
Methods
| Name | Description |
|---|---|
| AddXmlFormatters(IMvcCoreBuilder, Action<XmlFormatterOptions>) | Adds the XML serializer formatters to MVC. |
| AddXmlFormattersOptions(IMvcCoreBuilder, Action<XmlFormatterOptions>) | Adds configuration of XmlFormatterOptions for the application. |