关键是数据库表设计, 一般采用如下结构: ID , ParentId, //父类的ID Name , ...
代码设计要根据实际的需要来进行,如以下:model:public class TreeEntry { public int Id; public int ParentId; public string Name;}Dao:public class TreeDao { public void Insert( TreeEntry t ) { //insert into db } public vid Update( TreeEntry t ) { //update into db }......}
一般采用如下结构:
ID ,
ParentId, //父类的ID
Name ,
...
{
public int Id;
public int ParentId;
public string Name;}Dao:public class TreeDao
{
public void Insert( TreeEntry t )
{
//insert into db
}
public vid Update( TreeEntry t )
{
//update into db
}......}