• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# PathDefinition类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: GetCacheDependency

        /// <summary>
        /// Creates a cache dependency based on the specified virtual paths.
        /// </summary>
        /// <param name="definition">The definition.</param>
        /// <param name="virtualPath">The path to the primary virtual resource.</param>
        /// <returns>
        /// A <see cref="T:System.Web.Caching.CacheDependency"/> object for the specified virtual resources.
        /// </returns>
        public virtual CacheDependency GetCacheDependency(PathDefinition definition, string virtualPath, IEnumerable virtualPathDependencies, DateTime utcStart)
        {
            CacheDependency result = this.GetCurrentCacheDependency(definition, virtualPath, virtualPathDependencies, utcStart);

            //If the requested file does not exist in the current resolver then keep these dependencies and add dependencies of the next resolver.
            //This will allow the resolvers higher in the chain to be pinged again when the file might be available to them.
            if (this.Next != null && !this.CurrentExists(definition, virtualPath))
            {
                var nextDependencies = this.Next.GetCacheDependency(definition, virtualPath, virtualPathDependencies, utcStart);
                if (nextDependencies != null)
                {
                    if (result != null)
                    {
                        var aggr = new AggregateCacheDependency();
                        aggr.Add(result, nextDependencies);
                        result = aggr;
                    }
                    else
                    {
                        result = nextDependencies;
                    }
                }
            }

            return result;
        }
开发者ID:vkoppaka,项目名称:feather,代码行数:34,代码来源:ResourceResolverNode.cs


示例2: Exists

        /// <summary>
        /// Determines whether a file with the specified virtual path exists.
        /// </summary>
        /// <param name="virtualPath">The virtual path to check.</param>
        public virtual bool Exists(PathDefinition definition, string virtualPath)
        {
            virtualPath = this.RemoveParams(virtualPath);

            var resolverStrategy = ObjectFactory.Resolve<IResourceResolverStrategy>();
            return resolverStrategy.Exists(definition, virtualPath);
        }
开发者ID:harihisu,项目名称:feather,代码行数:11,代码来源:ResourceResolver.cs


示例3: GetCacheDependency

        /// <summary>
        /// Creates a cache dependency based on the specified virtual paths.
        /// </summary>
        /// <param name="definition">The definition.</param>
        /// <param name="virtualPath">The path to the primary virtual resource.</param>
        /// <returns>
        /// A <see cref="T:System.Web.Caching.CacheDependency"/> object for the specified virtual resources.
        /// </returns>
        public virtual CacheDependency GetCacheDependency(PathDefinition definition, string virtualPath, IEnumerable virtualPathDependencies, DateTime utcStart)
        {
            virtualPath = this.virtualPathBuilder.RemoveParams(virtualPath);

            var resolverStrategy = ObjectFactory.Resolve<IResourceResolverStrategy>();
            return resolverStrategy.GetCacheDependency(definition, virtualPath, virtualPathDependencies, utcStart);
        }
开发者ID:jeffpignataro,项目名称:feather,代码行数:15,代码来源:ResourceResolver.cs


示例4: Open

        /// <summary>
        /// Opens the the file with the specified virtual path.
        /// </summary>
        /// <param name="virtualPath">The virtual path of the file to open.</param>
        public virtual Stream Open(PathDefinition definition, string virtualPath)
        {
            virtualPath = this.virtualPathBuilder.RemoveParams(virtualPath);

            var resolverStrategy = ObjectFactory.Resolve<IResourceResolverStrategy>();
            return resolverStrategy.Open(definition, virtualPath);
        }
开发者ID:jeffpignataro,项目名称:feather,代码行数:11,代码来源:ResourceResolver.cs


示例5: GetControlPresentation

 /// <summary>
 /// Gets the control presentation that contains the requested resource from the database.
 /// </summary>
 /// <param name="virtualPathDefinition">The definition.</param>
 /// <param name="virtualPath">The virtual path.</param>
 /// <returns></returns>
 protected override ControlPresentation GetControlPresentation(PathDefinition virtualPathDefinition, string virtualPath)
 {
     if (this.ControlPresentationResult.ContainsKey(virtualPath))
         return this.ControlPresentationResult[virtualPath];
     else
         return null;
 }
开发者ID:jeffpignataro,项目名称:feather,代码行数:13,代码来源:DummyDatabaseResourceResolver.cs


示例6: Open

        /// <summary>
        /// Opens the the file with the specified virtual path.
        /// </summary>
        /// <param name="definition">The definition.</param>
        /// <param name="virtualPath">The virtual path of the file to open.</param>
        /// <returns></returns>
        public virtual Stream Open(PathDefinition definition, string virtualPath)
        {
            if (this.Next != null && !this.CurrentExists(definition, virtualPath))
                return this.Next.Open(definition, virtualPath);

            return this.CurrentOpen(definition, virtualPath);
        }
开发者ID:jeffpignataro,项目名称:feather,代码行数:13,代码来源:ResourceResolverNode.cs


示例7: CurrentOpen

 /// <inheritdoc />
 protected override Stream CurrentOpen(PathDefinition definition, string virtualPath)
 {
     Assembly assembly = this.GetAssembly(definition);
     var resourceName = this.GetResourceName(definition, virtualPath);
     var resources = assembly.GetManifestResourceNames();
     var caseSensitiveName = resources.First(r => string.Equals(resourceName, r, StringComparison.OrdinalIgnoreCase));
     var stream = assembly.GetManifestResourceStream(caseSensitiveName);
     return stream;
 }
开发者ID:vkoppaka,项目名称:feather,代码行数:10,代码来源:EmbeddedResourceResolver.cs


示例8: Exists

 /// <inheritdoc />
 public override bool Exists(PathDefinition definition, string virtualPath)
 {
     if (this.ExistsMock != null)
     {
         return this.ExistsMock(definition, virtualPath);
     }
     else
     {
         return base.Exists(definition, virtualPath);
     }
 }
开发者ID:jeffpignataro,项目名称:feather,代码行数:12,代码来源:DummyResolverStrategy.cs


示例9: CurrentExists

        /// <inheritdoc />
        protected override bool CurrentExists(PathDefinition definition, string virtualPath)
        {
            if (definition.ResourceLocation.IsNullOrEmpty())
                return false;

            Assembly assembly = this.GetAssembly(definition);
            var resourceName = this.GetResourceName(definition, virtualPath);
            var resources = assembly.GetManifestResourceNames();

            return resources.Contains(resourceName, StringComparer.OrdinalIgnoreCase);
        }
开发者ID:vkoppaka,项目名称:feather,代码行数:12,代码来源:EmbeddedResourceResolver.cs


示例10: GetCurrentFiles

        /// <inheritdoc />
        protected override IEnumerable<string> GetCurrentFiles(PathDefinition definition, string path)
        {
            var mappedPath = this.GetFileName(definition, path);
            if (mappedPath != null && Directory.Exists(mappedPath))
            {
                return Directory.GetFiles(mappedPath)
                                .Select(f => f.Replace(mappedPath, path));
            }

            return null;
        }
开发者ID:jeffpignataro,项目名称:feather,代码行数:12,代码来源:FileSystemResourceResolver.cs


示例11: CurrentOpen

        /// <inheritdoc />
        protected override Stream CurrentOpen(PathDefinition definition, string virtualPath)
        {
            var controlPresentation = this.GetControlPresentation(definition, virtualPath);
            if (controlPresentation != null && !controlPresentation.Data.IsNullOrEmpty())
            {
                var bytes = RouteHelper.GetContentWithPreamble(controlPresentation.Data);
                return new MemoryStream(bytes);
            }

            throw new ArgumentException("Could not find resource at " + virtualPath + " in the database.");
        }
开发者ID:RifasRazick,项目名称:feather,代码行数:12,代码来源:DatabaseResourceResolver.cs


示例12: GetControlPresentation

        /// <summary>
        /// Gets the control presentation that contains the requested resource from the database.
        /// </summary>
        /// <param name="definition">The definition.</param>
        /// <param name="virtualPath">The virtual path.</param>
        protected virtual ControlPresentation GetControlPresentation(PathDefinition definition, string virtualPath)
        {
            var resourceName = VirtualPathUtility.ToAppRelative(virtualPath);
            var areaName = VirtualPathUtility.AppendTrailingSlash(VirtualPathUtility.ToAppRelative(definition.VirtualPath));
            var extension = VirtualPathUtility.GetExtension(virtualPath).ToLower();

            var controlPresentation = PageManager.GetManager().GetPresentationItems<ControlPresentation>()
                .FirstOrDefault(cp => cp.AreaName == areaName && cp.NameForDevelopers == resourceName
                    && cp.DataType == extension);
            return controlPresentation;
        }
开发者ID:harihisu,项目名称:feather,代码行数:16,代码来源:DatabaseResourceResolver.cs


示例13: GetCurrentCacheDependency

        /// <inheritdoc />
        protected override CacheDependency GetCurrentCacheDependency(PathDefinition definition, string virtualPath, IEnumerable virtualPathDependencies, DateTime utcStart)
        {
            var controlPresentation = this.GetControlPresentation(definition, virtualPath);
            if (controlPresentation != null)
            {
                return new ControlPresentationCacheDependency(controlPresentation.Id.ToString());
            }

            // Change to any ControlPresentation record will invalidate the cache for this virtual path.
            return new ControlPresentationCacheDependency(typeof(ControlPresentation));
        }
开发者ID:jeffpignataro,项目名称:feather,代码行数:12,代码来源:DatabaseResourceResolver.cs


示例14: GetCacheDependency

 /// <inheritdoc />
 public override CacheDependency GetCacheDependency(PathDefinition definition, string virtualPath, IEnumerable virtualPathDependencies, DateTime utcStart)
 {
     if (this.GetCacheDependencyMock != null)
     {
         return this.GetCacheDependencyMock(definition, virtualPath, virtualPathDependencies, utcStart);
     }
     else
     {
         return base.GetCacheDependency(definition, virtualPath, virtualPathDependencies, utcStart);
     }
 }
开发者ID:jeffpignataro,项目名称:feather,代码行数:12,代码来源:DummyResolverStrategy.cs


示例15: GetCacheDependency

 public System.Web.Caching.CacheDependency GetCacheDependency(PathDefinition definition, string virtualPath, IEnumerable virtualPathDependencies, DateTime utcStart)
 {
     var id = this.ResolveFormDescriptionId(virtualPath);
     if (id != null && this.DescriptionExists(id.Value))
     {
         return new DataItemSystemCacheDependency(typeof(FormDescription), itemId: id.Value.ToString("D"));
     }
     else
     {
         return new DataItemSystemCacheDependency(typeof(FormDescription));
     }
 }
开发者ID:rhullah,项目名称:feather-widgets,代码行数:12,代码来源:FormsVirtualRazorResolver.cs


示例16: GetCurrentFiles

        /// <inheritdoc />
        protected override IEnumerable<string> GetCurrentFiles(PathDefinition definition, string path)
        {
            var resourceName = this.GetResourceName(definition, path);
            if (resourceName != null)
            {
                var assembly = this.GetAssembly(definition);
                return assembly.GetManifestResourceNames()
                    .Where(r => r.StartsWith(resourceName, StringComparison.OrdinalIgnoreCase))
                    .Select(r => r.Replace(resourceName, path));
            }

            return null;
        }
开发者ID:jeffpignataro,项目名称:feather,代码行数:14,代码来源:EmbeddedResourceResolver.cs


示例17: GetLayoutName_VirtualPath_ResolvesLayoutFileName

        public void GetLayoutName_VirtualPath_ResolvesLayoutFileName()
        {
            // Arrange
            var expectedLayoutName = "TestTitle";
            var testVirtualPath = "~/TestPrefix/TestTitle....master";
            var pathDefinition = new PathDefinition { VirtualPath = "~/TestPrefix" };

            // Act
            var layoutVirtualPathBuilder = new LayoutVirtualPathBuilder();
            var resultLayoutName = layoutVirtualPathBuilder.GetLayoutName(pathDefinition, testVirtualPath);

            // Assert
            Assert.AreEqual(expectedLayoutName, resultLayoutName, "The layout name is not extracted correctly.");
        }
开发者ID:ParabolaSoftware,项目名称:feather,代码行数:14,代码来源:LayoutVirtualPathBuilderTests.cs


示例18: GetLayoutName_WithoutMasterSuffix_ReturnsNull

        public void GetLayoutName_WithoutMasterSuffix_ReturnsNull()
        {
            // Arrange
            var testVirtualPath = "~/TestPrefix/TestTitle.test";
            var pathDefinition = new PathDefinition();
            pathDefinition.VirtualPath = "~/TestPrefix";

            // Act
            var layoutVirtualPathBuilder = new LayoutVirtualPathBuilder();
            var resultLayoutName = layoutVirtualPathBuilder.GetLayoutName(pathDefinition, testVirtualPath);

            // Assert
            Assert.IsNull(resultLayoutName, "The result layout name should be null if the virtual path doesn't end with 'master'.");
        }
开发者ID:ParabolaSoftware,项目名称:feather,代码行数:14,代码来源:LayoutVirtualPathBuilderTests.cs


示例19: GetCacheDependency

        /// <summary>
        /// Creates a cache dependency based on the specified virtual paths.
        /// </summary>
        /// <param name="definition">The definition.</param>
        /// <param name="virtualPath">The path to the primary virtual resource.</param>
        /// <returns>
        /// A <see cref="T:System.Web.Caching.CacheDependency"/> object for the specified virtual resources.
        /// </returns>
        public CacheDependency GetCacheDependency(PathDefinition definition, string virtualPath, IEnumerable virtualPathDependencies, DateTime utcStart)
        {
            virtualPath = this.virtualPathBuilder.RemoveParams(virtualPath);
            virtualPath = VirtualPathUtility.ToAppRelative(virtualPath);

            var layoutVirtualPathBuilder = new LayoutVirtualPathBuilder();
            string viewName = layoutVirtualPathBuilder.GetLayoutName(definition, virtualPath);
            var layoutTemplateBuilder = new LayoutRenderer();

            if (string.IsNullOrEmpty(viewName))
                return null;

            var viewPath = layoutTemplateBuilder.LayoutViewPath(viewName);
            return HostingEnvironment.VirtualPathProvider.GetCacheDependency(viewPath, virtualPathDependencies, utcStart);
        }
开发者ID:RJCuthbertson,项目名称:feather,代码行数:23,代码来源:LayoutVirtualFileResolver.cs


示例20: GetLayoutName

        /// <summary>
        /// Gets the layout file name from virtual path.
        /// </summary>
        /// <param name="definition">The definition.</param>
        /// <param name="virtualPath">The virtual path.</param>
        /// <returns></returns>
        public virtual string GetLayoutName(PathDefinition definition, string virtualPath)
        {
            if (!virtualPath.EndsWith(LayoutVirtualPathBuilder.LayoutSuffix, StringComparison.OrdinalIgnoreCase))
                return null;

            var definitionVp = VirtualPathUtility.AppendTrailingSlash(VirtualPathUtility.ToAppRelative(definition.VirtualPath));
            var pageTemplateNameLength = virtualPath.Length - definitionVp.Length - LayoutVirtualPathBuilder.LayoutSuffix.Length - 1;
            string pageTemplateName = virtualPath.Substring(definitionVp.Length, pageTemplateNameLength);

            while (!string.IsNullOrEmpty(pageTemplateName) && pageTemplateName.EndsWith(".", StringComparison.Ordinal))
            {
                pageTemplateName = pageTemplateName.Substring(0, pageTemplateName.Length - 1);
            }

            return pageTemplateName;
        }
开发者ID:ParabolaSoftware,项目名称:feather,代码行数:22,代码来源:LayoutVirtualPathBuilder.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# PathFormat类代码示例发布时间:2022-05-24
下一篇:
C# Path类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap