/// <summary> /// Processes the specified args. /// </summary> /// <param name="args">The args.</param> public void Process(PipelineArgs args) { IUnityContainer container = args.CustomData["UnityContainer"] as IUnityContainer; ShopContextFactory factory = container.Resolve <ShopContextFactory>(); container.RegisterType <ContextSwitcherDataSourceBase, ContentContextSwitcherDataSource>(new InjectionConstructor(factory)); }
/// <summary> /// Runs the processor. /// </summary> /// <param name="args"> /// The arguments. CustomData["UnityContainer_webSiteName"] will contain configured /// IoC container for website after processor execution. /// </param> public void Process(PipelineArgs args) { ShopContextFactory shopContextFactory = Context.AppContainer.Resolve <ShopContextFactory>(); ShopIoCConfigurationProvider shopIoCConfigurationProvider = Context.AppContainer.Resolve <ShopIoCConfigurationProvider>(); foreach (ShopContext shopContext in shopContextFactory.GetWebShops()) { IUnityContainer shopContainer = Context.AppContainer.CreateChildContainer(); shopIoCConfigurationProvider.ConfigureIoCContainerForWebShop(shopContext.InnerSite.Name, shopContainer); Context.ShopIoCContainers[shopContext.InnerSite.Name] = shopContainer; args.CustomData[GetPipelineArgumentKey(shopContext.InnerSite.Name)] = shopContainer; } }
public void Save() { //Ignore this if not SaveOnClose if (memoryItems == null) { return; } IShopContext saveContext; if (context == null) { saveContext = ShopContextFactory.CreateShopContext(); } else { saveContext = context; } saveContext.Save(memoryItems); }
/// <summary> /// Initializes a new instance of the <see cref="ContextSwitcherDataSourceBase" /> class. /// </summary> /// <param name="shopContextFactory">The shop context factory.</param> protected ContextSwitcherDataSourceBase(ShopContextFactory shopContextFactory) { this.shopContextFactory = shopContextFactory; }
/// <summary> /// Initializes a new instance of the <see cref="ContentContextSwitcherDataSource" /> class. /// </summary> /// <param name="shopContextFactory">The shop context factory.</param> public ContentContextSwitcherDataSource(ShopContextFactory shopContextFactory) : base(shopContextFactory) { }
private Shop() { context = ShopContextFactory.CreateShopContext(); //memoryItems.AddRange(context.GetAllItems()); maxId = Items.Max(item => item.ArticleNumber); }