Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

574 B
Raw Blame
using Grand.Infrastructure;

namespace Grand.Web.Common;

public class ContextAccessor : IContextAccessor
{
    private static readonly AsyncLocal<IWorkContext> _asyncLocalWorkContext = new();
    private static readonly AsyncLocal<IStoreContext> _asyncLocalStoreContext = new();

    public IWorkContext WorkContext {
        get => _asyncLocalWorkContext.Value;
        set => _asyncLocalWorkContext.Value = value;
    }
    public IStoreContext StoreContext {
        get => _asyncLocalStoreContext.Value;
        set => _asyncLocalStoreContext.Value = value;
    }
}