November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
Hi, try decorating your module with: [ModuleDependency(typeof(EPiServer.Web.InitializationModule))]
BR,
Marija
Read about tabs for epi7 preview (ttp://world.episerver.com/Forum/Developer-forum/EPiServer-7-Preview/Thread-Container/2012/10/Tabs-and-sort-index/) and tried to implement it on our epi 7.5 and ran into some problems:
StructureMap Exception Code: 202
No Default Instance defined for PluginFamily EPiServer.DataAbstraction.ITabDefinitionRepository, EPiServer, Version=7.6.5.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7
Looks like the problem is on this line:
var tabDefinitionRepository = ServiceLocator.Current.GetInstance<ITabDefinitionRepository>();
ANy idea what the problem is? added same code in alloy (version of epi is 7 I think) and it worked.
This is what I added:
[InitializableModule]
public class TabsInitializer : IInitializableModule
{
public void Initialize(InitializationEngine context)
{
var tabDefinitionRepository = ServiceLocator.Current.GetInstance<ITabDefinitionRepository>();
AddTabToList(tabDefinitionRepository, new TabDefinition() { Name = "Test", RequiredAccess = AccessLevel.Edit, SortIndex = 1000 });
}
public void Uninitialize(InitializationEngine context)
{
}
public void Preload(string[] parameters)
{
}
private void AddTabToList(ITabDefinitionRepository tabDefinitionRepository, TabDefinition definition)
{
TabDefinition existingTab = GetExistingTabDefinition(tabDefinitionRepository, definition);
if (existingTab != null)
{
definition.ID = existingTab.ID;
}
tabDefinitionRepository.Save(definition);
}
private static TabDefinition GetExistingTabDefinition(ITabDefinitionRepository tabDefinitionRepository, TabDefinition definition)
{
return tabDefinitionRepository.List()
.FirstOrDefault(
t =>
t.Name.Equals(definition.Name, StringComparison.InvariantCultureIgnoreCase));
}
}