Rank: Advanced Member
Groups: Authorized User, Developers Joined: 5/30/2020(UTC) Posts: 125
Thanks: 14 times Was thanked: 3 time(s) in 3 post(s)
|
The RegisterForAttribute does not seem to be working for me in the AbleCommerce web project. Is there something I have to do so that the web assembly is scanned and these implementations are loaded into Castle Windsor? This is how I'm using it to register my date helper... Code:[RegisterFor(typeof(IDateHelper), Lifestyle.Singleton)]
public class DateHelper : IReloadable, IDateHelper
I tried to resolve and use it within a controller using... Code:var helper = AbleContext.Container.Resolve<IDateHelper>();
However, this throws the exception: " Castle.MicroKernel.ComponentNotFoundException: No component for supporting the service AbleCommerce.Custom.IDateHelper was found"
|
|
|
|
Rank: Advanced Member
Groups: HelpDesk, Developers Joined: 11/9/2018(UTC) Posts: 564
Thanks: 122 times Was thanked: 26 time(s) in 25 post(s)
|
If your class and interface are not in the CommerceBuilder namespace and compiled as part of the CommerceBuilder class, you'll have to specify it explicitly in /App_Data/windsor.config for Castle Windsor to pick it up.
|
|
|
|
Rank: Advanced Member
Groups: Authorized User, Developers Joined: 5/30/2020(UTC) Posts: 125
Thanks: 14 times Was thanked: 3 time(s) in 3 post(s)
|
Curious why there isn't a way to set this up for the AbleCommerce assembly without going into the configs? RegisterFor and embedded .hbm.xml files both work for plugins and CommerceBuilder, but there isn't a way to register the AbleCommerce assembly to work the same way?
|
|
|
|
Rank: Advanced Member
Groups: HelpDesk, Developers Joined: 11/9/2018(UTC) Posts: 564
Thanks: 122 times Was thanked: 26 time(s) in 25 post(s)
|
You can have embedded hbm files in any class library. You just have to register that class library in the /App_Data/nHibernate.config. NHibernate only picks up embedded hbm files from classes you explicitly register. I always put all of mine in CommerceBuilder since it's already configured. The plugin manager does not include the ability to modify the class registration config file(s).
RegisterFor[] is part of the Castle Windsor implementation. It also has a config file /App_Data/Windsor.config where custom class libraries can be registered to be a container candidate.
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The AbleCommerce Forums uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close