protected void Application_Start()
{
GlobalConfiguration.Configure(WebApiConfig.Register);
//JSON Media-Type Formatter ref: http://www.asp.net/web-api/overview/formats-and-model-binding/json-and-xml-serialization
GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new DynamicContractResolver(); //DefaultContractResolver
//XML Media-Type Formatter ref:http://www.asp.net/web-api/overview/formats-and-model-binding/json-and-xml-serialization
GlobalConfiguration.Configuration.Formatters.XmlFormatter.UseXmlSerializer = true;
/*
//switched off XML and forced only JSON to be returned.
GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
GlobalConfiguration.Configuration.Formatters.Remove(GlobalConfiguration.Configuration.Formatters.XmlFormatter);
*/
}