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 : Monday, May 3, 2021 1:36:39 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)
I want to make use of some data from our custom database in multiple widgets on the product page. I'd like to cache the results of our lookup in the HttpContext the first time the function is hit to avoid extra database lookups later in the page. If we are using Plugins to add our functionality, what is the preferred method to access the HttpContext? Is it still HttpContext.Current?

The reason I ask is that we have been doing .Net Core development and they were injecting IHttpContextAccessor, so I could access it from the constructor of my custom classes. Wasn't sure if AC was doing anything similar.

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

shaharyartiwana25816656  
#2 Posted : Tuesday, May 4, 2021 12:56:03 AM(UTC)
shaharyar

Rank: Advanced Member

Groups: Admin, Developers, Registered, HelpDesk, Authorized User
Joined: 10/5/2018(UTC)
Posts: 703

Thanks: 5 times
Was thanked: 113 time(s) in 112 post(s)
Yes, you can use HttpContext.Current in plugins.

For example, if you have the source code, you can see our existing plugins implementations.

\IntegratedProviders\CanadaPost\CanadaPost.cs line: 483
Users browsing this topic
Guest
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.