本文整理汇总了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;
}
示例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",
};
}
示例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;
}
}
示例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>();
}
示例5: DbRazorEngine
public DbRazorEngine(IViewPageActivator viewPageActivator)
: base(viewPageActivator)
{
FileExtensions = new[] {
"dbcs",
"dbvb",
};
}
示例6: MrCMSRazorViewEngine
public MrCMSRazorViewEngine(IViewPageActivator viewPageActivator)
{
ViewPageActivator = viewPageActivator;
ViewLocationCache = HttpContext.Current == null
? DefaultViewLocationCache.Null
: new DefaultViewLocationCache();
}
示例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)
{
}
示例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;
}
示例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();
}
示例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();
}
示例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",
};
}
示例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"
);
}
}
示例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));
}
示例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));
}
示例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();
}