Created
April 14, 2020 07:51
-
-
Save Hangsolow/186592c639f2c72f640b61cc3dea4fb9 to your computer and use it in GitHub Desktop.
Content Delivery API config
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
[ModuleDependency(typeof(ContentApiCmsInitialization))] | |
public class ContentDeliveryApiInitialization : IConfigurableModule | |
{ | |
public void ConfigureContainer(ServiceConfigurationContext context) | |
{ | |
context.Services.Configure<ContentApiConfiguration>(config => | |
{ | |
config.Default() | |
.SetMinimumRoles(string.Empty) | |
.SetFlattenPropertyModel(true) | |
.SetIncludeNullValues(true) | |
.SetIncludeMasterLanguage(false) | |
.SetValidateTemplateForContentUrl(true) | |
.SetExtendedContentTypeModel(true); | |
}); | |
} | |
public void Initialize(InitializationEngine context) | |
{ | |
var jsonSerializer = context.Locate.Advanced.GetInstance<JsonSerializer>(); | |
jsonSerializer.Settings.NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore; | |
} | |
public void Uninitialize(InitializationEngine context) | |
{ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment