对于组织单位,我们使用下面的代码来获取组织单位中的实体,包括其子组织单位。是否合理,以及如何扩展IRepository将此功能添加到所有实体?public virtual List<Product> GetProductsInOuIncludingChildren(long organizationUnitId){ var code = _organizationUnitRepository.Get(organizationUnitId).Code; var query = from product in _productRepository.GetAll() join organizationUnit in _organizationUnitRepository.GetAll() on product.OrganizationUnitId equals organizationUnit.Id where organizationUnit.Code.StartsWith(code) select product; return query.ToList();}
2 回答
- 2 回答
- 0 关注
- 176 浏览
添加回答
举报
0/150
提交
取消