本文整理汇总了C#中System.Reflection.Assembly.GetLastWriteTimeUtc方法的典型用法代码示例。如果您正苦于以下问题:C# Assembly.GetLastWriteTimeUtc方法的具体用法?C# Assembly.GetLastWriteTimeUtc怎么用?C# Assembly.GetLastWriteTimeUtc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Reflection.Assembly
的用法示例。
在下文中一共展示了Assembly.GetLastWriteTimeUtc方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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));
}
示例3: PrecompiledMvcEngine
public PrecompiledMvcEngine(Assembly assembly, string baseVirtualPath, IViewPageActivator viewPageActivator)
{
_assemblyLastWriteTime = new Lazy<DateTime>(() => assembly.GetLastWriteTimeUtc(fallback: DateTime.MaxValue));
_baseVirtualPath = NormalizeBaseVirtualPath(baseVirtualPath);
base.AreaViewLocationFormats = new[] {
"~/Areas/{2}/Views/{1}/{0}.cshtml",
"~/Areas/{2}/Views/Shared/{0}.cshtml",
};
base.AreaMasterLocationFormats = new[] {
"~/Areas/{2}/Views/{1}/{0}.cshtml",
"~/Areas/{2}/Views/Shared/{0}.cshtml",
};
base.AreaPartialViewLocationFormats = new[] {
"~/Areas/{2}/Views/{1}/{0}.cshtml",
"~/Areas/{2}/Views/Shared/{0}.cshtml",
};
base.ViewLocationFormats = new[] {
"~/Views/{1}/{0}.cshtml",
"~/Views/Shared/{0}.cshtml",
};
base.MasterLocationFormats = new[] {
"~/Views/{1}/{0}.cshtml",
"~/Views/Shared/{0}.cshtml",
};
base.PartialViewLocationFormats = new[] {
"~/Views/{1}/{0}.cshtml",
"~/Views/Shared/{0}.cshtml",
};
base.FileExtensions = new[] {
"cshtml",
};
_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;
}