当前位置: 首页>>代码示例>>C#>>正文


C# IViewPageActivator类代码示例

本文整理汇总了C#中IViewPageActivator的典型用法代码示例。如果您正苦于以下问题:C# IViewPageActivator类的具体用法?C# IViewPageActivator怎么用?C# IViewPageActivator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IViewPageActivator类属于命名空间,在下文中一共展示了IViewPageActivator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PrecompiledMvcEngine

        public PrecompiledMvcEngine(Assembly assembly, string baseVirtualPath, IViewPageActivator viewPageActivator)
        {
            if (!Assemblies.Contains(assembly))
                Assemblies.Add(assembly);

            _assemblyLastWriteTime = new Lazy<DateTime>(() => assembly.GetLastWriteTimeUtc(fallback: DateTime.MaxValue));
            _baseVirtualPath = NormalizeBaseVirtualPath(baseVirtualPath);
            BaseLocationFormats();
            #if DEBUG
            var map = (from type in assembly.GetTypes()
                       where typeof(WebPageRenderingBase).IsAssignableFrom(type)
                       let pageVirtualPath =
                           type.GetCustomAttributes(inherit: false).OfType<PageVirtualPathAttribute>().FirstOrDefault()
                       where pageVirtualPath != null
                       select pageVirtualPath.VirtualPath);
            #endif

            _mappings = (from type in assembly.GetTypes()
                         where typeof(WebPageRenderingBase).IsAssignableFrom(type)
                         let pageVirtualPath = type.GetCustomAttributes(inherit: false).OfType<PageVirtualPathAttribute>().FirstOrDefault()
                         where pageVirtualPath != null
                         select new KeyValuePair<string, Type>(CombineVirtualPaths(_baseVirtualPath, pageVirtualPath.VirtualPath), type)
                         ).ToDictionary(t => t.Key, t => t.Value, StringComparer.OrdinalIgnoreCase);

            this.ViewLocationCache = new PrecompiledViewLocationCache(assembly.FullName, this.ViewLocationCache);
            _viewPageActivator = viewPageActivator
                ?? DependencyResolver.Current.GetService<IViewPageActivator>() /* For compatibility, remove this line within next version */
                ?? DefaultViewPageActivator.Current;
        }
开发者ID:akrisiun,项目名称:git-dot-aspx,代码行数:29,代码来源:PrecompiledMvcEngine.cs

示例2: WebFormViewEngine

        public WebFormViewEngine(IViewPageActivator viewPageActivator)
            :base(viewPageActivator){
            MasterLocationFormats = new[] {
                "~/Views/{1}/{0}.master",
                "~/Views/Shared/{0}.master"
            };

            AreaMasterLocationFormats = new[] {
                "~/Areas/{2}/Views/{1}/{0}.master",
                "~/Areas/{2}/Views/Shared/{0}.master",
            };

            ViewLocationFormats = new[] {
                "~/Views/{1}/{0}.aspx",
                "~/Views/{1}/{0}.ascx",
                "~/Views/Shared/{0}.aspx",
                "~/Views/Shared/{0}.ascx"
            };

            AreaViewLocationFormats = new[] {
                "~/Areas/{2}/Views/{1}/{0}.aspx",
                "~/Areas/{2}/Views/{1}/{0}.ascx",
                "~/Areas/{2}/Views/Shared/{0}.aspx",
                "~/Areas/{2}/Views/Shared/{0}.ascx",
            };

            PartialViewLocationFormats = ViewLocationFormats;
            AreaPartialViewLocationFormats = AreaViewLocationFormats;

            FileExtensions = new[] {
                "aspx",
                "ascx",
                "master",
            };
        }
开发者ID:adrianvallejo,项目名称:MVC3_Source,代码行数:35,代码来源:WebFormViewEngine.cs

示例3: BuildManagerViewEngine

        internal BuildManagerViewEngine(IViewPageActivator viewPageActivator, IResolver<IViewPageActivator> activatorResolver,
            IDependencyResolver dependencyResolver, VirtualPathProvider pathProvider)
        {
            if (viewPageActivator != null)
            {
                _viewPageActivator = viewPageActivator;
            }
            else
            {
                _activatorResolver = activatorResolver ?? new SingleServiceResolver<IViewPageActivator>(
                                                              () => null,
                                                              new DefaultViewPageActivator(dependencyResolver),
                                                              "BuildManagerViewEngine constructor");
            }

            if (pathProvider != null)
            {
                Func<VirtualPathProvider> providerFunc = () => pathProvider;
                _fileExistsCache = new FileExistenceCache(providerFunc);
                VirtualPathProviderFunc = providerFunc;
            }
            else
            {
                if (_sharedFileExistsCache == null)
                {
                    // Startup initialization race is OK providing service remains read-only
                    _sharedFileExistsCache = new FileExistenceCache(() => HostingEnvironment.VirtualPathProvider);
                }

                _fileExistsCache = _sharedFileExistsCache;
            }
        }
开发者ID:tlycken,项目名称:aspnetwebstack,代码行数:32,代码来源:BuildManagerViewEngine.cs

示例4: RazorView

 public RazorView(ControllerContext controllerContext, string viewPath, string layoutPath, bool runViewStartPages, IEnumerable<string> viewStartFileExtensions, IViewPageActivator viewPageActivator)
     : base(controllerContext, viewPath, viewPageActivator) {
     LayoutPath = layoutPath ?? String.Empty;
     RunViewStartPages = runViewStartPages;
     StartPageLookup = StartPage.GetStartPage;
     ViewStartFileExtensions = viewStartFileExtensions ?? Enumerable.Empty<string>();
 }
开发者ID:nobled,项目名称:mono,代码行数:7,代码来源:RazorView.cs

示例5: DbRazorEngine

 public DbRazorEngine(IViewPageActivator viewPageActivator)
     : base(viewPageActivator)
 {
     FileExtensions = new[] {
         "dbcs",
         "dbvb",
     };
 }
开发者ID:BGCX262,项目名称:zxd-svn-to-git,代码行数:8,代码来源:DbRazorEngine.cs

示例6: MrCMSRazorViewEngine

        public MrCMSRazorViewEngine(IViewPageActivator viewPageActivator)
        {
            ViewPageActivator = viewPageActivator;

            ViewLocationCache = HttpContext.Current == null
                ? DefaultViewLocationCache.Null
                : new DefaultViewLocationCache();
        }
开发者ID:neozhu,项目名称:MrCMS,代码行数:8,代码来源:MrCMSRazorViewEngine.cs

示例7: DebugInfoRazorView

 //call the base constructors
 public DebugInfoRazorView(ControllerContext controllerContext, 
     string viewPath, 
     string layoutPath, 
     bool runViewStartPages, 
     IEnumerable<string> viewStartFileExtensions,
     IViewPageActivator viewPageActivator)
     : base(controllerContext, viewPath, layoutPath, runViewStartPages, viewStartFileExtensions, viewPageActivator)
 {
 }
开发者ID:sabotuer99,项目名称:ExtensibilityMVC,代码行数:10,代码来源:DebugInfoRazorView.cs

示例8: PrecompiledMvcView

        ///// <summary>实例化预编译视图</summary>
        ///// <param name="virtualPath"></param>
        ///// <param name="type"></param>
        ///// <param name="runViewStartPages"></param>
        ///// <param name="fileExtension"></param>
        //public PrecompiledMvcView(String virtualPath, Type type, Boolean runViewStartPages, IEnumerable<String> fileExtension) : this(virtualPath, null, type, runViewStartPages, fileExtension) { }

        ///// <summary>实例化预编译视图</summary>
        ///// <param name="virtualPath"></param>
        ///// <param name="masterPath"></param>
        ///// <param name="type"></param>
        ///// <param name="runViewStartPages"></param>
        ///// <param name="fileExtension"></param>
        //public PrecompiledMvcView(String virtualPath, String masterPath, Type type, Boolean runViewStartPages, IEnumerable<String> fileExtension) : this(virtualPath, masterPath, type, runViewStartPages, fileExtension, null) { }

        /// <summary>实例化预编译视图</summary>
        /// <param name="virtualPath"></param>
        /// <param name="masterPath"></param>
        /// <param name="type"></param>
        /// <param name="runViewStartPages"></param>
        /// <param name="fileExtension"></param>
        /// <param name="viewPageActivator"></param>
        public PrecompiledMvcView(String virtualPath, String masterPath, Type type, Boolean runViewStartPages, IEnumerable<String> fileExtension, IViewPageActivator viewPageActivator)
        {
            _type = type;
            _virtualPath = virtualPath;
            _masterPath = masterPath;
            RunViewStartPages = runViewStartPages;
            ViewStartFileExtensions = fileExtension;
            //_viewPageActivator = (viewPageActivator ?? (DependencyResolver.Current.GetService<IViewPageActivator>() ?? DefaultViewPageActivator.Current));
            _viewPageActivator = viewPageActivator;
        }
开发者ID:tommybiteme,项目名称:X,代码行数:32,代码来源:PrecompiledMvcView.cs

示例9: RazorDatabaseViewEngine

        public RazorDatabaseViewEngine(IViewPageActivator viewPageActivator)
            : base(viewPageActivator)
        {
            viewLocations = DependencyResolver.Current.GetService<IProvideViewLocations>();
            viewKeyProcessor = DependencyResolver.Current.GetService<IViewKeyProcessor>();
            service = DependencyResolver.Current.GetService<IDatabaseViewService>();

            FileExtensions = new[] { "dbhtml" };

            ViewLocationCache = new NullViewLocationCache();
        }
开发者ID:jonathanstowell,项目名称:mvc-database-viewengine,代码行数:11,代码来源:RazorDatabaseViewEngine.cs

示例10: CsRazorViewEngine

 public CsRazorViewEngine(IViewPageActivator viewPageActivator)
     : base(viewPageActivator)
 {
     AreaViewLocationFormats = AreaViewLocationFormats.Where(f => f.EndsWith("cshtml")).ToArray();
     AreaMasterLocationFormats = AreaMasterLocationFormats.Where(f => f.EndsWith("cshtml")).ToArray();
     AreaPartialViewLocationFormats = AreaPartialViewLocationFormats.Where(f => f.EndsWith("cshtml")).ToArray();
     ViewLocationFormats = ViewLocationFormats.Where(f => f.EndsWith("cshtml")).ToArray();
     MasterLocationFormats = MasterLocationFormats.Where(f => f.EndsWith("cshtml")).ToArray();
     PartialViewLocationFormats = PartialViewLocationFormats.Where(f => f.EndsWith("cshtml")).ToArray();
     FileExtensions = FileExtensions.Where(f => f.EndsWith("cshtml")).ToArray();
 }
开发者ID:aaubry,项目名称:Celes,代码行数:11,代码来源:CsRazorViewEngine.cs

示例11: RazorViewEngine

        public RazorViewEngine(IViewPageActivator viewPageActivator)
            : base(viewPageActivator)
        {
            AreaViewLocationFormats = new[]
            {
                "~/Areas/{2}/Views/{1}/{0}.cshtml",
                "~/Areas/{2}/Views/{1}/{0}.vbhtml",
                "~/Areas/{2}/Views/Shared/{0}.cshtml",
                "~/Areas/{2}/Views/Shared/{0}.vbhtml"
            };
            AreaMasterLocationFormats = new[]
            {
                "~/Areas/{2}/Views/{1}/{0}.cshtml",
                "~/Areas/{2}/Views/{1}/{0}.vbhtml",
                "~/Areas/{2}/Views/Shared/{0}.cshtml",
                "~/Areas/{2}/Views/Shared/{0}.vbhtml"
            };
            AreaPartialViewLocationFormats = new[]
            {
                "~/Areas/{2}/Views/{1}/{0}.cshtml",
                "~/Areas/{2}/Views/{1}/{0}.vbhtml",
                "~/Areas/{2}/Views/Shared/{0}.cshtml",
                "~/Areas/{2}/Views/Shared/{0}.vbhtml"
            };

            ViewLocationFormats = new[]
            {
                "~/Views/{1}/{0}.cshtml",
                "~/Views/{1}/{0}.vbhtml",
                "~/Views/Shared/{0}.cshtml",
                "~/Views/Shared/{0}.vbhtml"
            };
            MasterLocationFormats = new[]
            {
                "~/Views/{1}/{0}.cshtml",
                "~/Views/{1}/{0}.vbhtml",
                "~/Views/Shared/{0}.cshtml",
                "~/Views/Shared/{0}.vbhtml"
            };
            PartialViewLocationFormats = new[]
            {
                "~/Views/{1}/{0}.cshtml",
                "~/Views/{1}/{0}.vbhtml",
                "~/Views/Shared/{0}.cshtml",
                "~/Views/Shared/{0}.vbhtml"
            };

            FileExtensions = new[]
            {
                "cshtml",
                "vbhtml",
            };
        }
开发者ID:huangw-t,项目名称:aspnetwebstack,代码行数:53,代码来源:RazorViewEngine.cs

示例12: BuildManagerViewEngine

 internal BuildManagerViewEngine(IViewPageActivator viewPageActivator, IResolver<IViewPageActivator> activatorResolver, IDependencyResolver dependencyResolver) {
     if (viewPageActivator != null) {
         _viewPageActivator = viewPageActivator;
     }
     else {
         _activatorResolver = activatorResolver ?? new SingleServiceResolver<IViewPageActivator>(
             () => null,
             new DefaultViewPageActivator(dependencyResolver),
             "BuildManagerViewEngine constructor"
         );
     }
 }
开发者ID:nobled,项目名称:mono,代码行数:12,代码来源:BuildManagerViewEngine.cs

示例13: PrecompiledMvcEngine

        /// <summary>实例化预编译Mvc引擎</summary>
        /// <param name="assembly"></param>
        /// <param name="baseVirtualPath"></param>
        /// <param name="viewPageActivator"></param>
        public PrecompiledMvcEngine(Assembly assembly, String baseVirtualPath, IViewPageActivator viewPageActivator)
            : base(viewPageActivator)
        {
            // 为了实现物理文件“重载覆盖”的效果,强制使用物理文件
            PreemptPhysicalFiles = false;
            UsePhysicalViewsIfNewer = false;

            _assemblyLastWriteTime = new Lazy<DateTime>(() => assembly.GetLastWriteTimeUtc(DateTime.MaxValue));
            _baseVirtualPath = NormalizeBaseVirtualPath(baseVirtualPath);
            AreaViewLocationFormats = new String[]
			{
				"~/Areas/{2}/Views/{1}/{0}.cshtml",
				"~/Areas/{2}/Views/Shared/{0}.cshtml"
			};
            AreaMasterLocationFormats = new String[]
			{
				"~/Areas/{2}/Views/{1}/{0}.cshtml",
				"~/Areas/{2}/Views/Shared/{0}.cshtml"
			};
            AreaPartialViewLocationFormats = new String[]
			{
				"~/Areas/{2}/Views/{1}/{0}.cshtml",
				"~/Areas/{2}/Views/Shared/{0}.cshtml"
			};
            ViewLocationFormats = new String[]
			{
				"~/Views/{1}/{0}.cshtml",
				"~/Views/Shared/{0}.cshtml"
			};
            MasterLocationFormats = new String[]
			{
				"~/Views/{1}/{0}.cshtml",
				"~/Views/Shared/{0}.cshtml"
			};
            PartialViewLocationFormats = new String[]
			{
				"~/Views/{1}/{0}.cshtml",
				"~/Views/Shared/{0}.cshtml"
			};
            FileExtensions = new String[]
			{
				"cshtml"
			};
            //_mappings = (
            //    from type in assembly.GetTypes()
            //    where typeof(WebPageRenderingBase).IsAssignableFrom(type)
            //    let pageVirtualPath = type.GetCustomAttributes(false).OfType<PageVirtualPathAttribute>().FirstOrDefault()
            //    where pageVirtualPath != null
            //    select new KeyValuePair<String, Type>(CombineVirtualPaths(_baseVirtualPath, pageVirtualPath.VirtualPath), type)).ToDictionary(t => t.Key, t => t.Value, StringComparer.OrdinalIgnoreCase);
            _mappings = GetTypeMappings(assembly, _baseVirtualPath);
            ViewLocationCache = new PrecompiledViewLocationCache(assembly.FullName, ViewLocationCache);
            //_viewPageActivator = (viewPageActivator ?? (DependencyResolver.Current.GetService<IViewPageActivator>() ?? DefaultViewPageActivator.Current));
        }
开发者ID:tommybiteme,项目名称:X,代码行数:57,代码来源:PrecompiledMvcEngine.cs

示例14: CompositePrecompiledMvcEngine

        /// <summary>复合预编译Mvc引擎</summary>
        /// <param name="viewAssemblies"></param>
        /// <param name="viewPageActivator"></param>
        public CompositePrecompiledMvcEngine(IEnumerable<PrecompiledViewAssembly> viewAssemblies, IViewPageActivator viewPageActivator)
            : base(viewPageActivator)
        {
            AreaViewLocationFormats = new String[]
			{
				"~/Areas/{2}/Views/{1}/{0}.cshtml",
				"~/Areas/{2}/Views/Shared/{0}.cshtml"
			};
            AreaMasterLocationFormats = new String[]
			{
				"~/Areas/{2}/Views/{1}/{0}.cshtml",
				"~/Areas/{2}/Views/Shared/{0}.cshtml"
			};
            AreaPartialViewLocationFormats = new String[]
			{
				"~/Areas/{2}/Views/{1}/{0}.cshtml",
				"~/Areas/{2}/Views/Shared/{0}.cshtml"
			};
            ViewLocationFormats = new String[]
			{
				"~/Views/{1}/{0}.cshtml",
				"~/Views/Shared/{0}.cshtml"
			};
            MasterLocationFormats = new String[]
			{
				"~/Views/{1}/{0}.cshtml",
				"~/Views/Shared/{0}.cshtml"
			};
            PartialViewLocationFormats = new String[]
			{
				"~/Views/{1}/{0}.cshtml",
				"~/Views/Shared/{0}.cshtml"
			};
            FileExtensions = new String[]
			{
				"cshtml"
			};
            foreach (var asm in viewAssemblies)
            {
                foreach (var type in asm.GetTypeMappings())
                {
                    _mappings[type.Key] = new ViewMapping
                    {
                        Type = type.Value,
                        ViewAssembly = asm
                    };
                }
            }
            //_viewPageActivator = (viewPageActivator ?? (DependencyResolver.Current.GetService<IViewPageActivator>() ?? DefaultViewPageActivator.Current));
        }
开发者ID:tommybiteme,项目名称:X,代码行数:53,代码来源:CompositePrecompiledMvcEngine.cs

示例15: ExtendedRazorViewEngine

        public ExtendedRazorViewEngine(IViewPageActivator viewPageActivator)
            : base(viewPageActivator)
        {
            FileExtensions = new[]
                                 {
                                     "html", "cshtml", "vbhtml"
                                 };

            ViewLocationFormats = new[]
                                      {
                                          "~/public/{0}.html",
                                          "~/public/Shared/{0}.html",
                                      }.Concat(ViewLocationFormats).ToArray();
        }
开发者ID:TorontoDotNetHackers,项目名称:TDNH-Meetup-Samples,代码行数:14,代码来源:ExtendedRazorViewEngine.cs


注:本文中的IViewPageActivator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。