// GET: Fallback public ActionResult Index() { var context = MvcRenderingContext.GetFromViewContext(this.ControllerContext.ParentActionViewContext); var gridContext = GridContext.GetFromRenderingContext(context); return(View(ViewName, null)); }
protected virtual void RegisterNitroNetSitecore(IServiceCollection serviceCollection) { serviceCollection.AddTransient <SitecoreNitroNetViewEngine>(); serviceCollection.AddTransient <ISitecoreRenderingRepository, SitecoreRenderingRepository>(); serviceCollection.AddTransient(x => GridContext.GetFromRenderingContext(ContextService.Get().GetCurrent <RenderingContext>())); serviceCollection.AddSingleton <ISitecoreCacheManager, SitecoreCacheManager>(); serviceCollection.AddSingleton <INitroTemplateHandlerFactory, SitecoreMvcNitroTemplateHandlerFactory>(); }
public void Configure(IServiceCollection serviceCollection) { serviceCollection.AddTransient(provider => GridContext.GetFromRenderingContext(ContextService.Get().GetCurrent <RenderingContext>())); serviceCollection.AddTransient <ISitecoreRenderingRepository, SitecoreRenderingRepository>(); serviceCollection.AddTransient <ISitecoreCacheManager, SitecoreCacheManager>(); serviceCollection.AddTransient <INitroTemplateHandlerFactory, SitecoreMvcNitroTemplateHandlerFactory>(); serviceCollection.AddTransient(provider => Context.Database); }
public void Configure(IUnityContainer container) { container.RegisterType <GridContext>( new InjectionFactory(u => GridContext.GetFromRenderingContext(ContextService.Get().GetCurrent <RenderingContext>()))); container.RegisterType <ISitecoreRenderingRepository, SitecoreRenderingRepository>(); container.RegisterType <ISitecoreCacheManager, SitecoreCacheManager>(new ContainerControlledLifetimeManager()); container.RegisterType <INitroTemplateHandlerFactory, SitecoreMvcNitroTemplateHandlerFactory>( new ContainerControlledLifetimeManager()); container.RegisterType <Database>(new InjectionFactory(u => Context.Database)); }
public void Configure(IWindsorContainer container) { container.Register(Component.For <GridContext>().UsingFactoryMethod(() => GridContext.GetFromRenderingContext(ContextService.Get().GetCurrent <RenderingContext>())).LifestyleTransient()); container.Register(Component.For <ISitecoreRenderingRepository>().ImplementedBy <SitecoreRenderingRepository>()); container.Register(Component.For <ISitecoreCacheManager>().ImplementedBy <SitecoreCacheManager>()); container.Register(Component.For <INitroTemplateHandlerFactory>().ImplementedBy <SitecoreMvcNitroTemplateHandlerFactory>()); container.Register(Component.For <Database>().UsingFactoryMethod(() => Context.Database)); }