Created
June 13, 2018 10:18
-
-
Save MattisOlsson/e69a7e81a2563ebc86b6645447a5702a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class WebApiConfig | |
{ | |
public static void Register(HttpConfiguration config) | |
{ | |
config.MapHttpAttributeRoutes(); | |
config.Configure(c => | |
{ | |
c.CamelCaseSerialization = true; | |
c.RemoveXmlFormatter = true; | |
}); | |
/* Keep all null values for React and checkout component state handling */ | |
config.Formatters.JsonFormatter.SerializerSettings = new JsonSerializerSettings | |
{ | |
NullValueHandling = NullValueHandling.Include, | |
ContractResolver = new CamelCasePropertyNamesContractResolver() | |
}; | |
config.Formatters.JsonFormatter.UseDataContractJsonSerializer = false; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[InitializableModule] | |
[ModuleDependency(typeof(FrameworkInitialization))] | |
public class WebApiInitialization : IInitializableModule | |
{ | |
public void Initialize(InitializationEngine context) | |
{ | |
WebApiConfig.Register(GlobalConfiguration.Configuration); | |
} | |
public void Uninitialize(InitializationEngine context) | |
{ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment