Ejemplo n.º 1
0
        public static PrecompiledMvcEngine Initialize(Type t, ContainerBuilder container)
        {
            var pathProvider = GetPathProvider(t);
            var engine       = new PhysicalWrapperEngine(t.Assembly, pathProvider)
            {
                UsePhysicalViewsIfNewer = true,
                AreaViewLocationFormats = new[] { "~/{2}/{1}/{0}.cshtml" }
            };

            ViewEngines.Engines.Insert(0, engine);

            // StartPage lookups are done by WebPages.
            VirtualPathFactoryManager.RegisterVirtualPathFactory(engine);

            container.RegisterInstance(pathProvider).AsImplementedInterfaces();

            return(engine);
        }
Ejemplo n.º 2
0
        private void RegisterViewEngine()
        {
            var engine = new PhysicalWrapperEngine(GetType().Assembly, CreateCorePathProvider());

            engine.ViewLocationFormats = engine.ViewLocationFormats.Concat(new[]
            {
                "~/{1}Module/{0}.cshtml",
            }).ToArray();

            engine.PartialViewLocationFormats = engine.PartialViewLocationFormats.Concat(new string[]
            {
                "~/{1}Module/{0}.cshtml",
            }).ToArray();

            ViewEngines.Engines.Insert(0, engine);

            // StartPage lookups are done by WebPages.
            VirtualPathFactoryManager.RegisterVirtualPathFactory(engine);
        }