지금은 저장소에 외래 키를 포함하는 일반적인 메서드를 만들려고합니다. 내가 현재 가지고 무엇제네릭 확장 메서드를 만들 때 문제가 발생했습니다.
은 이것이다 :
public static class ExtensionMethods
{
private static IQueryable<T> IncludeProperties<T>(this DbSet<T> set, params Expression<Func<T, object>>[] includeProperties)
{
IQueryable<T> queryable = set;
foreach (var includeProperty in includeProperties)
{
queryable = queryable.Include(includeProperty);
}
return queryable;
}
}
그러나 나는 오류 얻을 컴파일 할 때 :
The type 'T' must be a reference type in order to use it as parameter 'TEntity' in the generic type or method 'System.Data.Entity.DbSet'
여기에 문제가 될 수 무엇을? 당신의 방법 서명의 끝
아하 이봐. 도와 주셔서 정말로 고맙습니다! – JensOlsen112