DWQA QuestionsCategory: ProgramFour layer one to many relationship data structure
VincentTT asked 3 months ago

Four layer one to many relationship data structure
For this multi-layer one to many relational data structure, how to design data model better in C? How to design database tables better?

3 Answers
Border town answered 3 months ago

This is a tree You can define a tree node class by yourself

cspublic class Node {
    public string Name { get; set; }
    public object Data { get; set; }
    public List<Node> Children {
        get {
            return children ?? (children = new List<Node>());
        }
    }
    private List<Node> children; 
}
lhz19881204 answered 3 months ago

It can be realized by the way of database foreign key