I have this generic include in 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));
}
I have two tables:
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; }
}
I need to find BrandId
from Brand
table by ProductID
in Product
.
How can I use this generic include to find the BrandID
? What should I pass to this generic include?