0
我有以下,我想在包括的陣列,以通過和具有實體框架負載的方法和表達陣列中傳遞的關聯:通用代碼不的DbContext發現不執行包括
public static async Task<T> FindAsync<T>(this GSCMContext context, Expression<Func<T, bool>> match, , params Expression<Func<T, object>>[] includes) where T : BaseEntity
{
var set = context.Set<T>();
if(includes != null)
{
foreach (var include in includes)
{
set.Include(include);
}
}
return await set<T>().SingleOrDefaultAsync(match);
}
的問題是這些協會並沒有像我跑這個代碼一樣加載:
context.Entities.Include(a => a.association).Find(id)
我不知道爲什麼我的代碼不起作用。