除了对象的类型外,我有 7 个方法相同。
这是其中的两个:
1)
public MyResult CreateMyResult(MyResult mi, MyVersion myv)
{
MyVersionEntity myve = _db.MyVersionEntity.Where(r => r.Id == myv.Id).First();
MyResultEntity mie = new MyResultEntity();
myve.MyResultEntityAssoc.Add(mie);
mie = _updateMyResultEntity(mi, mie);
mi.Id = mie.Id;
return mi;
}
2)
public MyIssue CreateMyIssue(MyIssue mi, MyVersion myv)
{
MyVersionEntity myve = _db.MyVersionEntity.Where(r => r.Id == myv.Id).First();
MyIssueEntity mie = new MyIssueEntity();
myve.MyIssueEntityAssoc.Add(mie);
mie = _updateMyIssueEntity(mi, mie);
mi.Id = mie.Id;
return mi;
}
有没有办法合并所有这些?
谢谢!