I am using the following to accept XML serialized in my Core API App.
services.AddMvc(options =>
{
// allow xml
According to the source code, there's a constructor that has not been marked as Obsolete
:
public XmlSerializerInputFormatter(MvcOptions options)
This constructor takes an instance of MvcOptions
, so you can pass through your existing options
argument:
services.AddMvc(options =>
{
// allow xml format for input
options.InputFormatters.Add(new XmlSerializerInputFormatter(options));
}) ...
As of ASP.NET Core 3.0, this constructor is the only one available. Those that were marked obsolete have now been removed.