Try our conversational search powered by Generative AI!

Problem registering customized ContentAreaRenderer in our EPiServer 7.5 project.

Vote:
 

Hello,

We're trying to incorporate an adapted ContentAreaRenderer inspired by the Alloy-project but can't get it to work in our project. Seems like we're experiencing the same problem as mentioned in this forum post (http://world.episerver.com/Modules/Forum/Pages/Thread.aspx?id=114967) but we'd very muck like to avoid having to create a new project to get this to work. I've made some research and believe this has something to do with StructureMap but need your help to figure out why it's behaving the way it is.

Like in the Alloy project we register our version of the ContentAreaRenderer like this:

private static void ConfigureContainer(ConfigurationExpression container)
{
     container.For().Use();
}

If I run the following code in a controller in both Alloy and in our project I see differences that might explain the problem but I don't know how to solve it:

var services = DependencyResolver.Current.GetServices(typeof(ContentAreaRenderer));
var contentAreaRenderer = ServiceLocator.Current.GetInstance();

This gives the following result in Alloy:

And the following result in our project:

Any ideas or suggestions regarding taking this further is greatly appreciated!!

Best regards
Martin

#118450
Mar 06, 2015 11:56
Vote:
 

Happened to stumble across this blog post http://epiwiki.se/developing/core-functionality/ioc-container which includes the use of the attribute ModuleDependency. If I add this to my DependencyResolverInitialization-class it seems to work so maybe this is the solution to mine and other's similar problems?

Had a feeling that this problem had something to do with in what order things are initialized but didn't know how to solve this and I am still curious about why Alloy works without this attribute while our solution doesn't.

/Martin

#118456
Mar 06, 2015 14:51
Vote:
 
<p>Hi martin,<br /><br />Nice to hear that you got the solution. <br />Yes its weird why it works in Alloy and why not in our solutions.<br /><br />After you post, I tried the same with latest version (v8.0)<br />and I see its working without requiring ModuleDependency attribute<br />seems like they fixed issue?</p> <p>Thanks,<br />Raju</p>
#118498
Mar 09, 2015 7:00
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.