/// <summary> /// Sets the shop context. /// </summary> /// <param name="shopContext">The shop context.</param> private static void SetShopContext(ShopContext shopContext) { Context.Entity.RegisterInstance(typeof(ShopContext), null, shopContext, new HierarchicalLifetimeManager()); }
/// <summary> /// Initializes a new instance of the <see cref="ShopContextSwitcher"/> class. /// </summary> /// <param name="shopContext">The shop context.</param> public ShopContextSwitcher(ShopContext shopContext) { this.backup = Context.Entity.Resolve<ShopContext>(); SetShopContext(shopContext); }