那我只能再建立一个关系实体了,Dept、Emp,EmpRelation要这三个实体 public class Dept { public string DeptID{set;get;} public string DeptName{set;get;} public Dept(){} } public class Emp { public string EmpID{set;get;} public string EmpName{set;get;} public Emp(){} } public class EmpRelation { public string DeptID{set;get;} public string DeptName{set;get;} public string EmpID{set;get;} public string EmpName{set;get;} public EmpRelation(){} } insert部门用Dept实体,insert员工用Emp实体,查询用EmpRelation了 我希望能找到更好的方法解决.
如果IList数据很多,会影响到性能吧。
最简单的方法如下 public class Dept { public string DeptID{set;get;} public string DeptName{set;get;} public Dept(){} public override string ToString() { return DeptName; } }
那我只能再建立一个关系实体了,Dept、Emp,EmpRelation要这三个实体
public class Dept
{
public string DeptID{set;get;}
public string DeptName{set;get;}
public Dept(){}
} public class Emp
{
public string EmpID{set;get;}
public string EmpName{set;get;}
public Emp(){}
} public class EmpRelation
{
public string DeptID{set;get;}
public string DeptName{set;get;}
public string EmpID{set;get;}
public string EmpName{set;get;}
public EmpRelation(){}
}
insert部门用Dept实体,insert员工用Emp实体,查询用EmpRelation了
我希望能找到更好的方法解决.
如果IList数据很多,会影响到性能吧。
public class Dept
{
public string DeptID{set;get;}
public string DeptName{set;get;}
public Dept(){} public override string ToString()
{
return DeptName;
}
}
没看明白 重写了tostring,只是返回部门名称