【发布时间】:2023-03-12 19:30:01
【问题描述】:
我有 3 个实体。
产品
语言标识
产品名称
类别
语言标识
猫名
产品类型
语言标识
类型名称
如您所见,它们每个都有 LangID 属性。
我希望能够创建一个通用存储库,它只包含一个返回Func<T, bool> GetLmbLang()的函数
public interface IBaseRepository<T> where T : class
{
Func<T, bool> GetLmbLang();
}
public class BaseRepository<T> : IBaseRepository<T> where T : class
{
public Func<T, bool> GetLmbLang()
{
//ERROR HERE
//That dosen't work here
return (p => p.LangID == 1);
}
}
有人有想法???。
【问题讨论】:
标签: asp.net-mvc-2 entity-framework-4 lambda repository-pattern