1

我正在关注有关工作单元模式的教程,但我的代码无法编译,因为它无法识别接口签名中的位置,也无法识别类型 T。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace DataLayer.Repository
{
   public interface IGenericRepository<T> : where T : class
{
    IQueryable<T> AsQueryable();

    IEnumerable<T> GetAll();
    IEnumerable<T> Find(Expression<Func<T, bool>> predicate);
    T Single(Expression<Func<T, bool>>  predicate);
    T SingleOrDefault(Expression<Func<T, bool>> predicate);
    T First(Expression<Func<T, bool>> predicate);
    T GetById(int id);

    void Add(T entity);
    void Delete(T entity);
    void Attach(T entity);
}
}

谁能看到我错过了什么?

4

1 回答 1

2

请删除多余的:,如下所示:

public interface IGenericRepository<T> where T : class
于 2015-06-13T15:00:37.607 回答