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
jdepoy24549696  
#1 Posted : Tuesday, July 26, 2022 1:04:33 PM(UTC)
jdepoy24549696

Rank: Advanced Member

Groups: Authorized User, Developers, Registered
Joined: 4/17/2019(UTC)
Posts: 80

I'm working on a site with some legacy code from AC Gold written in visual basic. Does anyone know how to convert code like this to work in AC9?

Dim dataSource As ProductDataSource = New ProductDataSource()
Dim pCol As IList(Of Product) = dataSource.LoadForStore(AbleContext.Current.StoreId)

Any help would be appreciated.

Thanks

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

jdepoy24549696  
#2 Posted : Tuesday, July 26, 2022 1:52:31 PM(UTC)
jdepoy24549696

Rank: Advanced Member

Groups: Authorized User, Developers, Registered
Joined: 4/17/2019(UTC)
Posts: 80

I think something like this may work:

Dim dataSource As CommerceBuilder.Products.IProductRepository = CommerceBuilder.Common.AbleContext.Container.Resolve(Of CommerceBuilder.Products.IProductRepository)()
Dim pCol As IList(Of CommerceBuilder.Products.Product) = dataSource.LoadForStore(CommerceBuilder.Common.AbleContext.Current.StoreId)
nadeem  
#3 Posted : Wednesday, July 27, 2022 6:08:38 AM(UTC)
nadeem

Rank: Advanced Member

Groups: Administrators, Developers, Registered, HelpDesk, Authorized User, Admin, System
Joined: 10/11/2018(UTC)
Posts: 110

Thanks: 19 times
Was thanked: 18 time(s) in 18 post(s)
First of all, add the following two using statements on the top

Code:
using CommerceBuilder.Products;
using CommerceBuilder.Common;


Then you can convert your legacy code like this:

Code:
var products = AbleContext.Container.Resolve<IProductRepository>().LoadForStore(AbleContext.Current.StoreId);
Users browsing this topic
Guest (2)
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.