开发者

What is the best way to implement a family tree using ASP.NET MVC & SQL Server

I am trying to create a Family Tree website (for personal use) using MVC3 and SQL Server 2008 however I am relativly new to MVC3 (Using Razor & Entity Framework) but know SQL Server quite well. I am getting quite frustrated and am tempted to develop the website using WebForms as I am very familiar with this tech.

My question is I am split between the following two approaches but am stuck on how to implement either using MVC3 and Entity Framework: 1) using a Person table containing information about an individual and a 开发者_开发问答bridging table to store relationships between individuals held on the Person table.

2) Nested Sets storing all information on one table.

Can someone please, please give me some direction on how I can get started, preferably using the Nested Sets approach as I would like the performance of reading the hierarchy to be as quick as possible as this will be the main purpose of the site.

I hope I have provided enough information, if not please ask me for more details.


The way you organize your data in the data store has very little to do with MVC. All the data access is abstracted in the M part (the model) and how it is implemented in the back end does not matter, the model layer can be different but still present the same layer to the controler (the C part.)

This is exactly the reason for using a system like MVC. You could (for example) implement an MVC web site using MS SQL and then at a later time move to Oracle. The only code which would need to change is the code in the Model. MVC allows for separation of concerns.

So, to answer your question: Implement the SQL design in the way you think will work best. Then when the Model is written it will be "translated" to an interface needed for the controllers and the view.


Coda - I personally think it is easier to implement this data using more than one table, I think it makes the queries clearer. Your mileage may vary.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜