Exemple #1
0
        public TenantContext(IWindsorContainer container, string assembly)
        {
            this.assembly = assembly;
            Container     = container;

            viewEngine = new WebFormViewEngine
            {
                MasterLocationFormats = new[]
                {
                    "~/Tenants/" + this.assembly + "/{1}/{0}.master",
                    "~/Tenants" + this.assembly + "/Shared/{0}.master",
                    "~/Views/{1}/{0}.master",
                    "~/Views/Shared/{0}.master"
                },
                ViewLocationFormats = new[]
                {
                    "~/Tenants/" + this.assembly + "/{1}/{0}.aspx",
                    "~/Tenants/" + this.assembly + "/{1}/{0}.ascx",
                    "~/Tenants/" + this.assembly + "/Shared/{0}.aspx",
                    "~/Tenants/" + this.assembly + "/Shared/{0}.ascx",
                    "~/Views/{1}/{0}.aspx",
                    "~/Views/{1}/{0}.ascx",
                    "~/Views/Shared/{0}.aspx",
                    "~/Views/Shared/{0}.ascx"
                }
            };
        }
        public IViewEngine CreateModulesViewEngine(CreateModulesViewEngineParams parameters)
        {
            var areaFormats = new[] {
                "~/Core/{2}/Views/{1}/{0}.ascx",
                "~/Core/{2}/Views/{1}/{0}.aspx",
                "~/Modules/{2}/Views/{1}/{0}.ascx",
                "~/Modules/{2}/Views/{1}/{0}.aspx",
                "~/Themes/{2}/Views/{1}/{0}.ascx",
                "~/Themes/{2}/Views/{1}/{0}.aspx",
            };

            //Logger.Debug("AreaFormats (module): \r\n\t-{0}", string.Join("\r\n\t-", areaFormats));

            var universalFormats = parameters.VirtualPaths
                                   .SelectMany(x => new[] {
                x + "/Views/{0}.ascx",
                x + "/Views/{0}.aspx",
            })
                                   .ToArray();

            //Logger.Debug("UniversalFormats (module): \r\n\t-{0}", string.Join("\r\n\t-", universalFormats));

            var viewEngine = new WebFormViewEngine {
                MasterLocationFormats          = DisabledFormats,
                ViewLocationFormats            = universalFormats,
                PartialViewLocationFormats     = universalFormats,
                AreaMasterLocationFormats      = DisabledFormats,
                AreaViewLocationFormats        = areaFormats,
                AreaPartialViewLocationFormats = areaFormats,
            };

            return(viewEngine);
        }
        public static void RegisterViewEngine()
        {
            ViewEngines.Engines.Clear();
            WebFormViewEngine viewEngine = new WebFormViewEngine();

            viewEngine.PartialViewLocationFormats
                = partialViewLocations.ToArray().Concat(viewEngine.PartialViewLocationFormats).ToArray();
            ViewEngines.Engines.Add(viewEngine);
        }
            public TokenViewEngine()
            {
                var tokenLocations = new[] { Url.ResolveTokens("{ManagementUrl}/Tokens/{0}.ascx") };

                inner = new WebFormViewEngine
                {
                    AreaMasterLocationFormats      = noLocations,
                    AreaPartialViewLocationFormats = noLocations,
                    AreaViewLocationFormats        = noLocations,
                    MasterLocationFormats          = noLocations,
                    PartialViewLocationFormats     = tokenLocations,
                    ViewLocationFormats            = tokenLocations,
                    ViewLocationCache = new DefaultViewLocationCache()
                };
            }
        /// <summary>Adds a view engine that resolves tokens from N2's management path.</summary>
        /// <param name="viewEngines">The view engines to append.</param>
        public static void RegisterTokenViewEngine(this ViewEngineCollection viewEngines)
        {
            var noLocations    = new string[0];
            var tokenLocations = new[] { Url.ResolveTokens("{ManagementUrl}/Tokens/{0}.ascx") };
            var ve             = new WebFormViewEngine
            {
                AreaMasterLocationFormats      = noLocations,
                AreaPartialViewLocationFormats = noLocations,
                AreaViewLocationFormats        = noLocations,
                MasterLocationFormats          = noLocations,
                PartialViewLocationFormats     = tokenLocations,
                ViewLocationFormats            = tokenLocations,
                ViewLocationCache = new DefaultViewLocationCache()
            };

            viewEngines.Add(ve);
        }
        public IViewEngine CreateThemeViewEngine(CreateThemeViewEngineParams parameters)
        {
            // Area: if "area" in RouteData. Url hit for module...
            // Area-Layout Paths - no-op because LayoutViewEngine uses multi-pass instead of layout paths
            // Area-View Paths - no-op because LayoutViewEngine relies entirely on Partial view resolution
            // Area-Partial Paths - enable theming views associated with a module based on the route

            // Layout Paths - no-op because LayoutViewEngine uses multi-pass instead of layout paths
            // View Paths - no-op because LayoutViewEngine relies entirely on Partial view resolution
            // Partial Paths -
            //   {area}/{controller}/

            // for "routed" request views...
            // enable /Views/{area}/{controller}/{viewName}

            // enable /Views/{partialName}
            // enable /Views/"DisplayTemplates/"+{templateName}
            // enable /Views/"EditorTemplates/+{templateName}
            var partialViewLocationFormats = new[] {
                parameters.VirtualPath + "/Views/{0}.ascx",
                parameters.VirtualPath + "/Views/{0}.aspx",
            };

            //Logger.Debug("PartialViewLocationFormats (theme): \r\n\t-{0}", string.Join("\r\n\t-", partialViewLocationFormats));

            var areaPartialViewLocationFormats = new[] {
                parameters.VirtualPath + "/Views/{2}/{1}/{0}.ascx",
                parameters.VirtualPath + "/Views/{2}/{1}/{0}.aspx",
            };

            //Logger.Debug("AreaPartialViewLocationFormats (theme): \r\n\t-{0}", string.Join("\r\n\t-", areaPartialViewLocationFormats));

            var viewEngine = new WebFormViewEngine {
                MasterLocationFormats          = DisabledFormats,
                ViewLocationFormats            = DisabledFormats,
                PartialViewLocationFormats     = partialViewLocationFormats,
                AreaMasterLocationFormats      = DisabledFormats,
                AreaViewLocationFormats        = DisabledFormats,
                AreaPartialViewLocationFormats = areaPartialViewLocationFormats,
                ViewLocationCache = new ThemeViewLocationCache(parameters.VirtualPath),
            };

            return(viewEngine);
        }
 public RenderFubuWebFormView(WebFormViewEngine <IFubuView> engine, IFubuRequest request, ViewPath view, IViewActivator activator)
     : base(engine, request, view, activator)
 {
 }
 public RenderFubuWebFormView(WebFormViewEngine<IFubuView> engine, IFubuRequest request, ViewPath view, IViewActivator activator)
     : base(engine, request, view, activator)
 {
 }