事情是这样的。
我有一个接口,我想把属于EntityFramework库的Include
扩展方法放在我的IRepository
层中,而这一层不需要知道EntityFramework。
public interface IRepository<TEntity>
{
IQueryable<TEntity> Entities { get; }
TEntity GetById(long id);
TEntity Insert(TEntity entity);
void Update(TEntity entity);
void Delete(TEntity entity);
void Delete(long id);
}
我有一个扩展方法:
public static class IncludeExtension
{
static IQueryable<TEntity> Include<TEntity>(this IQueryable<TEntity> query,
string path)
{
throw new NotImplementedException();
}
}
但我不知道如何在这一层中实现它,并且我想将其发送到我的EntityFramework(或者任何实现IRepository的人)来处理。
我需要一个带有扩展方法的接口。
有什么建议吗?