使用 WPF 我想有一个 TreeView 以可变方式显示来自紧凑型数据库的数据。这意味着我想根据用户希望它的排序方式来更改视图。
假设数据库有以下表和模式,我该如何设置我的视图?正如我所说,它们应该是可变的,但如果可能的话,我会考虑使用多个 HierarchialDataTemplates。下面列出了一些想到的潜在观点。
感谢您提供的任何帮助!
Employee
ID - Int primary Unique AutoIncrement
Name – string
Department - int (foreign relation to Department. ID)
Supervisor - int (ID of Employee in this table)
Division
ID - Int primary Unique AutoIncrement
Name – Unique string
DivisionLeader - int (foreign relation to Employee. ID)
Department
ID - Int primary Unique AutoIncrement
Name – Unique string
DepartmentLeader - int (foreign relation to Employee. ID)
Division – int (foreign relation to Division. ID)
CustomerSupportDepartments
ID - Int primary Unique AutoIncrement
Name – string
Department - int (foreign relation to Department. ID)
Continent - int (foreign relation to Continent. ID)
Country - int (foreign relation to Country. ID)
State - int (foreign relation to State. ID)
City - int (foreign relation to City. ID)
Customer
ID - Int primary Unique AutoIncrement
Name – string
SalesRep - (foreign relation to Employee. ID)
Revenue . int
Continent - int (foreign relation to Continent. ID)
Country - int (foreign relation to Country. ID)
State - int (foreign relation to State. ID)
City - int (foreign relation to City. ID)
Continent
ID - Int primary Unique AutoIncrement
Name – Unique string
Country
ID - Int primary Unique AutoIncrement
Name – Unique string
State
ID - Int primary Unique AutoIncrement
Name – Unique string
City
ID - Int primary Unique AutoIncrement
Name – Unique string
潜在观点
View 1
Employees
Employee Name 1
Supervisor
Name
Department
Name
Customers
Name 1
Name 2
Name 3
Employee Name 2
Supervisor
Name
Department
Name
Customers
Name 1
Name 2
Name 3
View 2
Departments
Department Name 1
Division
Name
Supervisor
Name
Employees
Employee Name 1
Employee Name 2
Department Name 2
Division
Name
Supervisor
Name
Employees
Employee Name 1
Employee Name 2
View 3
Divisions
Division Name 1
Departments
Department Name 1
Department Name 2
Division Name 2
Departments
Department Name 1
Department Name 2
View 4
Continents
Continent Name 1
Country Name 1
City Name 1
Customers
Customer Name 1
Sales Representative
Employee Name
Revenue
Sum
Customer Name 2
Sales Representative
Employee Name
Revenue
Sum
Country Name 2
City Name 1
Customers
Customer Name 1
Sales Representative
Employee Name 1
Revenue
Sum
City Name 2
Customers
Customer Name 1
Sales Representative
Employee Name 1
Revenue
Sum
Customer Name 2
Sales Representative
Employee Name
Revenue
Sum
View 5
Customers
Customer Name 1
Sales Representative
Employee Name
Sales Representative’s Supervisor
Employee Name
Location
Continent
Country
State
City
Revenue
Sum
Customer Name 2
Sales Representative
Employee Name
Sales Representative’s Supervisor
Employee Name
Location
Continent
Country
State
City
Revenue
Sum