Table of Contents

MvcCoreBuilderExtensions Class

Definition

Namespace
Cuemon.Extensions.AspNetCore.Mvc.Formatters.Xml
Assemblies
Cuemon.Extensions.AspNetCore.Mvc.Formatters.Xml.dll
Source
src/Cuemon.Extensions.AspNetCore.Mvc.Formatters.Xml/MvcCoreBuilderExtensions.cs

Extension methods for the IMvcCoreBuilder interface.

public static class MvcCoreBuilderExtensions
Inheritance
object
MvcCoreBuilderExtensions

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.