У меня есть это общее включение в ASP.NET Core:
public IQueryable<T> AllIncluding(params Expression<Func<T, object>>[] includeProperties)
{
IQueryable<T> query = _uow.Set<T>();
return includeProperties.Aggregate(query, (current, includeProperty) => current.Include(includeProperty));
}
У меня есть две таблицы:
public class Brand
{
public int BrandId { get; set; }
public string BFaName { get; set; }
public string BEnName { get; set; }
public int CatId { get; set; }
public virtual ICollection<Category> Categories { get; set; }
public virtual ICollection<ProductBrand> ProductBrands { get; set; }
}
public class ProductBrand
{
public int Id { get; set; }
public virtual Brand Brand { get; set; }
public virtual Product Product { get; set; }
}
Мне нужно найти BrandId
из Brand
таблицыProductID
in Product
.
Как я могу использовать это универсальное включение, чтобы найти BrandID
?Что я должен передать этому универсальному включению?