I am using WEB API to return an object (class).
Class is already being structured using System.Xml.Serialization attributes, which makes if difficult to return entire cl
ASP.NET Web API does use the serialization attributes defined at the class level. However, XmlMediaTypeFormatter
uses DataContractSerializer
by default. Since you are using XmlSerializer
, you need to tell Web API to use the same, like this.
GlobalConfiguration.Configuration.Formatters
.XmlFormatter.UseXmlSerializer = true;