我在数据访问层中有以下方法:
GetByFilterIncluding(Expression<Func<TEntity, bool>> filter, params Expression<Func<TEntity, object>>[] includeProperties)
现在我必须从业务层调用它,包括属性:
dll.GetByFilterIncluding(x => x.Id == id, x => x.Person, x => x.Address)
但是,我想这样称呼它:
if (needPerson) {
includeProperties.Add((x => x.Person));
}
if (needAddress) {
includeProperties = (x => x.Address);
}
dll.GetByFilterIncluding(x => x.Id == id, includeProperties)
我根本不明白如何定义includeProperties
数组/列表?
修改 作为注释 - 我无法访问数据访问层,我无法更改它。