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

C# SourceMetadataDictionary类代码示例

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

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



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

示例1: SiteMapTitle

 /// <summary>
 /// Gets the title of SiteMap.CurrentNode
 /// </summary>
 /// <param name="helper">MvcSiteMapHtmlHelper instance</param>
 /// <param name="templateName">Name of the template.</param>
 /// <param name="sourceMetadata">User-defined meta data.</param>
 /// <returns>The title of the CurrentNode or the RootNode (if CurrentNode is null)</returns>
 public static MvcHtmlString SiteMapTitle(this MvcSiteMapHtmlHelper helper, string templateName, SourceMetadataDictionary sourceMetadata)
 {
     var model = BuildModel(GetSourceMetadata(sourceMetadata), helper.SiteMap.CurrentNode ?? helper.SiteMap.RootNode);
     return helper
         .CreateHtmlHelperForModel(model)
         .DisplayFor(m => model, templateName);
 }
开发者ID:chaoaretasty,项目名称:MvcSiteMapProvider,代码行数:14,代码来源:SiteMapTitleHelper.cs


示例2: CanonicalTag

 /// <summary>
 /// Gets the CanonicalUrl of SiteMap.CurrentNode
 /// </summary>
 /// <param name="helper">MvcSiteMapHtmlHelper instance</param>
 /// <param name="sourceMetadata">User-defined meta data.</param>
 /// <returns>The CanonicalUrl of the CurrentNode or the RootNode (if CurrentNode is null)</returns>
 public static MvcHtmlString CanonicalTag(this MvcSiteMapHtmlHelper helper, SourceMetadataDictionary sourceMetadata)
 {
     return CanonicalTag(helper, null, sourceMetadata);
 }
开发者ID:agrynco,项目名称:MvcSiteMapProvider,代码行数:10,代码来源:CanonicalHelper.cs


示例3: SiteMap

 /// <summary>
 /// Build a sitemap tree, based on the MvcSiteMap
 /// </summary>
 /// <param name="helper">The helper.</param>
 /// <param name="sourceMetadata">User-defined meta data.</param>
 /// <returns>Html markup</returns>
 public static MvcHtmlString SiteMap(this MvcSiteMapHtmlHelper helper, SourceMetadataDictionary sourceMetadata)
 {
     return SiteMap(helper, helper.SiteMap.RootNode, sourceMetadata);
 }
开发者ID:pickist,项目名称:MvcSiteMapProvider,代码行数:10,代码来源:SiteMapHelper.cs


示例4: BuildModel

        /// <summary>
        /// Builds the model.
        /// </summary>
        /// <param name="helper">The helper.</param>
        /// <param name="sourceMetadata">User-defined meta data.</param>
        /// <param name="startingNode">The starting node.</param>
        /// <param name="startingNodeInChildLevel">Renders startingNode in child level if set to <c>true</c>.</param>
        /// <returns>The model.</returns>
        private static SiteMapHelperModel BuildModel(MvcSiteMapHtmlHelper helper, SourceMetadataDictionary sourceMetadata, ISiteMapNode startingNode, bool startingNodeInChildLevel)
        {
            // Build model
            var model = new SiteMapHelperModel();
            var node = startingNode;

            // Check visibility and ACL
            if (node != null && node.IsVisible(sourceMetadata) && node.IsAccessibleToUser())
            {
                // Add node
                var nodeToAdd = new SiteMapNodeModel(node, sourceMetadata);
                model.Nodes.Add(nodeToAdd);

                // Add child nodes
                if (startingNodeInChildLevel)
                {
                    model.Nodes.AddRange(nodeToAdd.Descendants);
                }
            }

            return model;
        }
开发者ID:pickist,项目名称:MvcSiteMapProvider,代码行数:30,代码来源:SiteMapHelper.cs


示例5: Menu

 /// <summary>
 /// Build a menu, based on the MvcSiteMap
 /// </summary>
 /// <param name="helper">The helper.</param>
 /// <param name="templateName">Name of the template.</param>
 /// <param name="startingNodeLevel">The starting node level.</param>
 /// <param name="startingNodeInChildLevel">Show starting node in child level if set to <c>true</c>.</param>
 /// <param name="showStartingNode">Show starting node if set to <c>true</c>.</param>
 /// <param name="maxDepth">The max depth.</param>
 /// <param name="sourceMetadata">User-defined meta data.</param>
 /// <returns>Html markup</returns>
 public static MvcHtmlString Menu(this MvcSiteMapHtmlHelper helper, string templateName, int startingNodeLevel, bool startingNodeInChildLevel, bool showStartingNode, int maxDepth, SourceMetadataDictionary sourceMetadata)
 {
     return Menu(helper, templateName, startingNodeLevel, startingNodeInChildLevel, showStartingNode, maxDepth, false, false, sourceMetadata);
 }
开发者ID:pickist,项目名称:MvcSiteMapProvider,代码行数:15,代码来源:MenuHelper.cs


示例6: MetaRobotsTag

 /// <summary>
 /// Gets the content attribute value of the meta robots tag for the SiteMap.CurrentNode
 /// </summary>
 /// <param name="helper">MvcSiteMapHtmlHelper instance</param>
 /// <returns>
 /// The content attribute value for the meta robots tag of the CurrentNode or the RootNode (if CurrentNode is null)
 /// </returns>
 public static MvcHtmlString MetaRobotsTag(this MvcSiteMapHtmlHelper helper, SourceMetadataDictionary sourceMetadata)
 {
     return MetaRobotsTag(helper, null, sourceMetadata);
 }
开发者ID:Guymestef,项目名称:MvcSiteMapProvider,代码行数:11,代码来源:MetaRobotsHelper.cs


示例7: SiteMapPath

 /// <summary>
 /// Gets SiteMap path for the current request
 /// </summary>
 /// <param name="helper">MvcSiteMapHtmlHelper instance</param>
 /// <param name="templateName">Name of the template.</param>
 /// <returns>SiteMap path for the current request</returns>
 public static MvcHtmlString SiteMapPath(this MvcSiteMapHtmlHelper helper, string templateName, SourceMetadataDictionary sourceMetadata)
 {
     return SiteMapPath(helper, templateName, string.Empty, sourceMetadata);
 }
开发者ID:ghost1face,项目名称:Mvc5SiteMapBuilder,代码行数:10,代码来源:SiteMapPathHelper.cs


示例8: BuildModel

        /// <summary>
        /// Builds the model.
        /// </summary>
        /// <param name="helper">The helper.</param>
        /// <param name="startingNode">The starting node.</param>
        /// <param name="sourceMetadata">User-defined meta data.</param>
        /// <returns>The model.</returns>
        private static SiteMapPathHelperModel BuildModel(MvcSiteMapHtmlHelper helper, SourceMetadataDictionary sourceMetadata, SiteMapNode startingNode)
        {
            // Build model
            var model = new SiteMapPathHelperModel();
            var node = startingNode;
            while (node != null)
            {
                bool nodeVisible = node.IsVisible(sourceMetadata);
                if (nodeVisible && node.IsAccessibleToUser())
                {
                    var nodeToAdd = new SiteMapNodeModel(helper.SiteMap, node, sourceMetadata);
                    model.Nodes.Add(nodeToAdd);
                }
                node = node.GetParentNode(helper.SiteMap);
            }
            model.Nodes.Reverse();

            return model;
        }
开发者ID:ghost1face,项目名称:Mvc5SiteMapBuilder,代码行数:26,代码来源:SiteMapPathHelper.cs


示例9: Menu

 /// <summary>
 /// Build a menu, based on the MvcSiteMap
 /// </summary>
 /// <param name="helper">The helper.</param>
 /// <param name="startingNodeLevel">The starting node level.</param>
 /// <param name="maxDepth">The max depth.</param>
 /// <param name="allowForwardSearch">if set to <c>true</c> allow forward search. Forward search will search all parent nodes and child nodes, where in other circumstances only parent nodes are searched.</param>
 /// <param name="drillDownToCurrent">Should the model exceed the maxDepth to reach the current node?</param>
 /// <param name="visibilityAffectsDescendants"><b>true</b> if the visibility provider should affect the current node as well as all descendant nodes; otherwise <b>false</b>.</param>
 /// <param name="sourceMetadata">User-defined meta data.</param>
 /// <returns>Html markup</returns>
 public static MvcHtmlString Menu(this MvcSiteMapHtmlHelper helper, int startingNodeLevel, int maxDepth, bool allowForwardSearch, bool drillDownToCurrent, bool visibilityAffectsDescendants, SourceMetadataDictionary sourceMetadata)
 {
     ISiteMapNode startingNode = GetStartingNode(GetCurrentNode(helper.SiteMap), startingNodeLevel, allowForwardSearch);
     if (startingNode == null)
     {
         return MvcHtmlString.Empty;
     }
     return Menu(helper, null, startingNode, true, false, maxDepth, drillDownToCurrent, visibilityAffectsDescendants, sourceMetadata);
 }
开发者ID:Guymestef,项目名称:MvcSiteMapProvider,代码行数:20,代码来源:MenuHelper.cs


示例10: BuildModel

 /// <summary>
 /// Builds the model.
 /// </summary>
 /// <param name="startingNode">The starting node.</param>
 /// <param name="sourceMetadata">User-defined meta data.</param>
 /// <returns>The model.</returns>
 private static SiteMapTitleHelperModel BuildModel(SourceMetadataDictionary sourceMetadata, ISiteMapNode startingNode)
 {
     // Map to model
     return new SiteMapTitleHelperModel
     {
         CurrentNode = new SiteMapNodeModel(startingNode, sourceMetadata)
     };
 }
开发者ID:chaoaretasty,项目名称:MvcSiteMapProvider,代码行数:14,代码来源:SiteMapTitleHelper.cs


示例11: BuildModel

        /// <summary>
        /// Builds the model.
        /// </summary>
        /// <param name="helper">The helper.</param>
        /// <param name="sourceMetadata">User-defined meta data.</param>
        /// <param name="startingNode">The starting node.</param>
        /// <param name="startingNodeInChildLevel">Renders startingNode in child level if set to <c>true</c>.</param>
        /// <param name="showStartingNode">Show starting node if set to <c>true</c>.</param>
        /// <param name="maxDepth">The max depth.</param>
        /// <param name="drillDownToCurrent">Should the model exceed the maxDepth to reach the current node</param>
        /// <returns>The model.</returns>
        private static MenuHelperModel BuildModel(MvcSiteMapHtmlHelper helper, SourceMetadataDictionary sourceMetadata, ISiteMapNode startingNode, bool startingNodeInChildLevel, bool showStartingNode, int maxDepth, bool drillDownToCurrent)
        {
            // Build model
            var model = new MenuHelperModel();
            var node = startingNode;

            // Check if a starting node has been given
            if (node == null)
            {
                return model;
            }

            // Check ACL
            if (node.IsAccessibleToUser())
            {
                // Add node?
                var nodeToAdd = new SiteMapNodeModel(node, sourceMetadata, maxDepth, drillDownToCurrent, startingNodeInChildLevel);
                // Check visibility
                if (node.IsVisible(sourceMetadata))
                {
                    if (showStartingNode || !startingNodeInChildLevel)
                    {
                        model.Nodes.Add(nodeToAdd);
                    }
                    // Add child nodes
                    if (startingNodeInChildLevel)
                    {
                        model.Nodes.AddRange(nodeToAdd.Children);
                    }
                }
            }

            return model;
        }
开发者ID:pickist,项目名称:MvcSiteMapProvider,代码行数:45,代码来源:MenuHelper.cs


示例12: GetSourceMetadata

 /// <summary>
 /// Gets the source meta data for the current context.
 /// </summary>
 /// <param name="sourceMetadata">User-defined metadata.</param>
 /// <returns>SourceMetadataDictionary for the current request.</returns>
 private static SourceMetadataDictionary GetSourceMetadata(IDictionary<string, object> sourceMetadata)
 {
     var result = new SourceMetadataDictionary(sourceMetadata);
     result.Add("HtmlHelper", typeof(SiteMapHelper).FullName);
     return result;
 }
开发者ID:pickist,项目名称:MvcSiteMapProvider,代码行数:11,代码来源:SiteMapHelper.cs


示例13: BuildModel

        /// <summary>
        /// Builds the model.
        /// </summary>
        /// <param name="helper">The helper.</param>
        /// <param name="sourceMetadata">User-defined meta data.</param>
        /// <param name="startingNode">The starting node.</param>
        /// <param name="startingNodeInChildLevel">Renders startingNode in child level if set to <c>true</c>.</param>
        /// <returns>The model.</returns>
        internal static SiteMapHelperModel BuildModel(MvcSiteMapHtmlHelper helper, SourceMetadataDictionary sourceMetadata, ISiteMapNode startingNode, bool startingNodeInChildLevel, bool visibilityAffectsDescendants)
        {
            // Build model
            var model = new SiteMapHelperModel();
            var node = startingNode;

            // Check if a starting node has been given
            if (node == null)
            {
                return model;
            }

            // Check ACL
            if (node.IsAccessibleToUser())
            {
                // Add node?
                var nodeToAdd = new SiteMapNodeModel(node, sourceMetadata, Int32.MaxValue, false, startingNodeInChildLevel, visibilityAffectsDescendants);

                // Check visibility
                if (node.IsVisible(sourceMetadata))
                {
                    model.Nodes.Add(nodeToAdd);

                    // Add child nodes
                    if (visibilityAffectsDescendants && startingNodeInChildLevel)
                    {
                        model.Nodes.AddRange(nodeToAdd.Children);
                    }
                }
                // Add child nodes
                if (!visibilityAffectsDescendants && startingNodeInChildLevel)
                {
                    model.Nodes.AddRange(nodeToAdd.Children);
                }
            }

            return model;
        }
开发者ID:Relix1990,项目名称:MvcSiteMapProvider,代码行数:46,代码来源:SiteMapHelper.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# SourceRange类代码示例发布时间:2022-05-24
下一篇:
C# SourceLocation类代码示例发布时间: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