logo
Welcome to our new AbleCommerce forums. As a guest, you may view the information here. To post to this forum, you must have a registered account with us, either as a new user evaluating AbleCommerce or an existing user of the application. For all questions related to the older version of Gold and earlier, please go to AbleCommerce Gold forum. Please use your AbleCommerce username and password to Login. New Registrations are disabled.

Notification

Icon
Error

Options
Go to last post Go to first unread
sweeperqb  
#1 Posted : Wednesday, August 4, 2021 4:32:00 PM(UTC)
sweeperqb

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"

Wanna join the discussion?! Login to your AbleCommerce Forums forum account. New Registrations are disabled.

Joe Payne2  
#2 Posted : Thursday, August 5, 2021 3:42:13 AM(UTC)
Joe Payne2

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.
sweeperqb  
#3 Posted : Tuesday, June 14, 2022 7:37:23 PM(UTC)
sweeperqb

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?
Joe Payne2  
#4 Posted : Wednesday, June 15, 2022 9:26:53 AM(UTC)
Joe Payne2

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.



Users browsing this topic
Guest (4)
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.