Created
July 31, 2016 16:17
-
-
Save casper-rasmussen/6ed32018491e618973c6f049dcdbed3b to your computer and use it in GitHub Desktop.
This file contains hidden or 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(EPiServer.Web.InitializationModule))] | |
public class CustomContentProviderInitialization : IInitializableModule | |
{ | |
private bool _isInitialized; | |
public void Initialize(InitializationEngine context) | |
{ | |
if (!this._isInitialized) | |
{ | |
var contentProvider = context.Locate.Advanced.GetInstance<CustomContentProvider>(); | |
// add configuration settings for entry point and capabilites | |
var providerValues = new NameValueCollection { | |
{ ContentProviderElement.EntryPointString, contentProvider.GetEntryPoint(DataRepositoryDescriptor.RepositoryKey).ToString() }, | |
{ ContentProviderElement.CapabilitiesString, "Edit,MultiLanguage" } | |
}; | |
// initialize and register the provider | |
contentProvider.Initialize(TranslationDataRepositoryDescriptor.RepositoryKey, providerValues); | |
var providerManager = context.Locate.Advanced.GetInstance<IContentProviderManager>(); | |
providerManager.ProviderMap.AddProvider(contentProvider); | |
} | |
this._isInitialized = true; | |
} | |
public void Uninitialize(InitializationEngine context) { } | |
public void Preload(string[] parameters) { } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment