ASP.NET:自定义动态填充站点地图(SiteMapProvider)
我正在尝试编写我自己的第一个 SiteMapProvider
子类。它旨在使用一堆不同的数据库查找动态填充,就像我在网上找到的所有示例一样。
然而,有很多事情我不太清楚。这是我的第一个问题:
- 为什么几乎每个人的项目中都使用
StaticSiteMapProvider
而不是SiteMapProvider
?由于该类包含名称“static”,所以我的印象是它不像我想要的那样……嗯,动态的。 - 有人可以为我提供一个超级简约的
SiteMapProvider
子类,它仅使用静态数据填充地图,即没有数据库访问等?
I'm trying to write my first very own SiteMapProvider
subclass. It is meant to be populated dynamically using a bunch of different database lookups, much like all of the examples I've found on the web.
However, there are a whole bunch of things that are quite unclear to me. Here are my two first questions:
- Why is
StaticSiteMapProvider
used in virtually everyone's project instead ofSiteMapProvider
? Since the class contains the name "static", I'm getting the impression that it's not as...well, dynamic as I want it. - Can someone provide me with a super-minimalistic
SiteMapProvider
subclass which populates the map using only static data, i.e. no database access, etc.?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
SiteMapProvider
可以是完全动态的。例如,它可以仅针对节点进行动态查找。与StaticSiteMapProvider
相比,您应该了解整个结构。所以这由您决定选择什么。您可以查看
XmlSiteMapProvider
,这是“静态”地图提供程序的一个很好的示例。我没有检查这个,但应该可以。
SiteMapProvider
can be tottaly dynamic. For example it can make dynamic lookup just for nodes. In contrast withStaticSiteMapProvider
you should know whole structure. So this for you to decide what to choose.You can look at the
XmlSiteMapProvider
, this is good example of "static" map provider.I did not checked this, but should work.