在Repository模式当中,都能看到IRepository<T> where T : class,其中在申明接口的时候,出现了“where”和“:”,想问一下,这种用法在此处是不是表示条件限制,限制<T>为Class(类)呢,还有表示其它含意呢?
另外,有没有其它案例是用到了Repository模式的,除了oxite之外?
interface IRepository<T> where T : class
{
IEnumerable<T> FindAll(Func<T, bool> exp);
void Add(T entity);
void Delete(T entity);
void Save();
}
...全文
611打赏收藏
对MVC当中常用的Repository模式一点小疑惑,望高手指教!
在Repository模式当中,都能看到IRepository where T : class,其中在申明接口的时候,出现了“where”和“:”,想问一下,这种用法在此处是不是表示条件限制,限制为Class(类)呢,还有表示其它含意呢? 另外,有没有其它案例是用到了Repository模式的,除了oxite之外? interface IRepository where T : class { IEnumerable FindAll(Func exp);