AbleCommerce Forums
»
AbleCommerce
»
General Questions
»
Entries in nhibernate.config and windsor.config
Rank: Advanced Member
Groups: Developers
Joined: 11/7/2018(UTC) Posts: 303
Thanks: 21 times Was thanked: 5 time(s) in 5 post(s)
|
I am re-writing one of our plugins so that I am just adding all the files to the solution instead of using a plugin. The plugin was written by another developer years ago and I can't get an upgrade to 909 to pick it up, probably our fault. I always have trouble figuring out what kind of entries to put into the windsor.config, so I usually use the namespace AbleCommerce.Code on repos I create, but this code has several files and uses a different namespace. What entries would I put into nhibernate.config and windsor.config for this repo, as an example? There are numerous other classes including the ContentSliderSettingRepository.cs and I have made sure that the ContentSliderSetting class is embeded.
namespace W2M.ContentSliderPlugin.Code { using System.Collections.Generic; using CommerceBuilder.DomainModel;
/// <summary> /// Interface for Location entities /// </summary> public interface IContentSliderSettingRepository : IRepository<ContentSliderSetting> { ContentSliderSetting LoadForContentSlider(int sliderId); } }
I've tried <component id="ContentSliderSettingRepo" service="W2M.ContentSliderPlugin.Code.IContentSliderSettingRepository, W2M.ContentSliderPlugin" type="W2M.ContentSliderPlugin.Code.ContentSliderSettingRepository, W2M.ContentSliderPlugin"/> and get the following error: Could not convert string 'W2M.ContentSliderPlugin.Code.ContentSliderSettingRepository, W2M.ContentSliderPlugin' to a type. Assembly was not found. Make sure it was deployed and the name was not mistyped.
I have added the following to nhibernate.config <mapping assembly="W2M.ContentSliderPlugin"/>
Thanks
|
|
|
|
Rank: Advanced Member
Groups: Admin, Developers, Registered, HelpDesk, Authorized User Joined: 10/5/2018(UTC) Posts: 704
Thanks: 5 times Was thanked: 113 time(s) in 112 post(s)
|
Quote:I am re-writing one of our plugins so that I am just adding all the files to the solution instead of using a plugin. Are you creating a separate class library or adding the files in one of the existing projects. If you are creating files in one of the existing projects, then there is no need to add anything in nhibernate.config and to register the repositories, instead of using windsor.config, there is a RegisterForAttribute that you add at top of the ContentSliderSettingRepository.cs class. If creating classes in Ablecommerce project, then add <mapping assembly="AbleCommerce"/> in nhibernate.config e.g Code:[RegisterFor(typeof(IContentSliderSettingRepository))]
[RegisterFor(typeof(IRepository<ContentSliderSetting>))]
You might get some help from this old forum post. https://www.ablecommerce...rsister-for-custom-tableHope this helps.
|
|
|
|
Rank: Advanced Member
Groups: Developers
Joined: 11/7/2018(UTC) Posts: 303
Thanks: 21 times Was thanked: 5 time(s) in 5 post(s)
|
Thanks for the answer. The files are included in the AbleCommerce project, but they don't use the AbleCommerce namespace right now. That is the issue- trying to figure out what to put in the nhibernate.config and windsor.config. I'll just give up and change them all to AbleCommerce namespace
|
|
|
|
Rank: Advanced Member
Groups: Developers
Joined: 11/7/2018(UTC) Posts: 303
Thanks: 21 times Was thanked: 5 time(s) in 5 post(s)
|
I've tried something new to troubleshoot this. I know it is not AC code, but am asking for some resources to troubleshoot. I've googled, but must be using the wrong search terms and I don't know if it is an nhibernate, windsor or database issue. I was able to install the plugin in question on a different 909 site OK, but when I try to access it on the dev site for the site I am upgrading, I still get unable to locate a persister error. The files on the dev site are the same as the live site- I have copied them over from the plugins folder, including the zip, the plugin folder itself and the installedplugins.xml entry. I made a new backup of the live site and restored as dev database and changed the dev site to use that. This all didn't work. I took another custom entity from another 909 site, added the table to the dev site database, copied the class, hbm.xml, IRepository,Repository files over. Set the .hbm.xml file to embed. Add the same entries in the nhibernate.config and windsor.config files as were in the site where it worked. Compiled the site solution, restarted the app pool. I get the same persister error. Is there a way I can debug this that I haven't thought of? I am hesitant to assume that the plugin will still work after the upgrade until I can figure out the issue. Thanks for any help.
|
|
|
|
Rank: Advanced Member
Groups: Developers
Joined: 11/7/2018(UTC) Posts: 303
Thanks: 21 times Was thanked: 5 time(s) in 5 post(s)
|
Here's what I get when I debug to step through code. 2024-03-21_9-26-05.png (8kb) downloaded 5 time(s).
|
|
|
|
Rank: Advanced Member
Groups: Admin, Developers, Registered, HelpDesk, Authorized User Joined: 10/5/2018(UTC) Posts: 704
Thanks: 5 times Was thanked: 113 time(s) in 112 post(s)
|
The error message seems related to the nHibernate mapping. Please make sure that the hbm.xml files are copied correctly from live to dev site.
|
|
|
|
Rank: Advanced Member
Groups: Developers
Joined: 11/7/2018(UTC) Posts: 303
Thanks: 21 times Was thanked: 5 time(s) in 5 post(s)
|
Thanks, they are all there. Any more ideas?
|
|
|
|
Rank: Advanced Member
Groups: Developers
Joined: 11/7/2018(UTC) Posts: 303
Thanks: 21 times Was thanked: 5 time(s) in 5 post(s)
|
I found the issue! It was a mapping file for a sql table that had been removed as we upgrade.Not related to the plugin at all.
|
|
|
|
AbleCommerce Forums
»
AbleCommerce
»
General Questions
»
Entries in nhibernate.config and windsor.config
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