这是我的导航最好的数据库模式? [英] Which is the best database schema for my navigation?

查看:216
本文介绍了这是我的导航最好的数据库模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个网站,所有网页挂完一个数据库驱动的树状层次结构。

I'm creating a web site where all pages hang off a database-driven tree-hierarchy.

所有,但一个节点都有一个父节点。节点可以具有基于角色的读取权限。一些节点可能有特殊的规则(如:做导航菜单中不会显示)。

All but one node has a parent node. Nodes may have role-based read permissions. Some nodes may have special rules (such as: don't display within navigation menus).

节点可能会重新present链接到其他节点(如Windows中的快捷方式)。节点通常重新present页面。

Nodes may represent links to other nodes (like a shortcut in Windows). Nodes typically represent pages.

页present使用HTML内容或执行程序。有些可能是子树的根(备用masterpages和样式表)。

Pages present either HTML content or execute programming. Some pages may be roots of subtrees (alternate masterpages and stylesheets).

请帮我安装Microsoft SQL Server中我的节点数据库使用的LINQ到SQL。

Please help me setup my nodes database in Microsoft SQL Server for use by Linq to SQL.

我有三个想法:

  1. 许多轻量级表,几乎 零nullalbe领域。

  1. Many lightweight tables with almost zero nullalbe fields.

重量级的节点表中有很多 nullalbe领域。

Heavyweight Node table with lots of nullalbe fields.

两个最好的(或最坏):很多 nullalbe外键许多 轻巧的表。

Best (or worst) of both: Lots of nullalbe foreign keys to many lightweight tables.

哪个你觉得最好再presents数据?这将是最容易使用LINQ使用到SQL?

Which do you feel best represents the data? Which will be easiest to use with Linq to SQL?

我如何能保持在数据库中我的数据完整性规则?我怎样尽我最大的编程内实施?

How can I keep my data integrity rules within the database? How do I best enforce them within my programming?

  • 节点必须是(但不能同时) 链接或网页。

  • Nodes must be either (but not both) links or pages.

页面必须是(但不能同时)HTML或code。

Pages must be either (but not both) html or code.

链接可能不是根,HTML,也不是code。

Links may not be roots, html, nor code.

我可以做一个ASP.NET站点地图提供这样一个结构呢?要这样呢?

Can I make an ASP.NET Site Map Provider with such a structure? Should I?


更新:我问一个更普遍的问题:

Update: I've asked a more general question:

什么来处理在SQL中的一对一的关系的最佳方式?


相关问题:
<一href="http://stackoverflow.com/questions/86181/how-do-i-enforce-data-integrity-rules-in-my-database">How我执行我的数据库中的数据完整性规则?

Related question:
How do I enforce data integrity rules in my database?

推荐答案

我同意使用LINQ一点设计是低音ackwards。乔Celko的书树木和层次结构在SQL for Smarties一有很多很好的想法模式来再present你想要做的事。 LINQ的应该能够处理这些就好了。

I agree that designing with Linq in mind is bass-ackwards. Joe Celko's book "Trees and Hierarchies in SQL For Smarties" has many good ideas for schemas to represent what you're trying to do. Linq ought to be able to deal with these just fine.

这篇关于这是我的导航最好的数据库模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆