哪个是我导航的最佳数据库架构?

时间:2023-02-16
本文介绍了哪个是我导航的最佳数据库架构?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个网站,其中所有页面都挂在数据库驱动的树状层次结构上.

除一个节点外,所有节点都有一个父节点.节点可能具有基于角色的读取权限.某些节点可能有特殊规则(例如:不在导航菜单中显示).

节点可能代表到其他节点的链接(如 Windows 中的快捷方式).节点通常代表页面.

页面显示 HTML 内容或

<小时>

相关问题:
如何在我的数据库中执行数据完整性规则?

解决方案

阅读您的帖子后,我的第一印象是我非常反对让任何一项技术(在这种情况下为 linq)大量使用在您似乎建议的范围内影响数据库架构设计.

我认为您的架构应该几乎相同,无论您选择何种技术来构建业务/表示层.

希望我没有误会你.

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).

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

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

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

I've got three ideas:

  1. Many lightweight tables with almost zero nullalbe fields.

  2. Heavyweight Node table with lots of nullalbe fields.

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

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.

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

  • Links may not be roots, html, nor code.

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


Update: I've asked a more general question:

What’s the best way to handle one-to-one relationships in SQL?


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

解决方案

My initial impression after reading your post is that I would be very averse to let any one technology (in this case linq) heavily influence the database schema design to the extent you seem to be suggesting.

I think your schema should be pretty much the same, regardless of what technology you then chose to build your business/presentation layers.

I hope I haven't misunderstood you.

这篇关于哪个是我导航的最佳数据库架构?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

上一篇:使用 LIST 插入存储过程 下一篇:是否可以在 asp.net 中使用静态 LINQ to SQL DataConte

相关文章

最新文章