1
我正在按照工作单元模式进行教程,我的代码无法编译,因为它无法识别接口签名中的哪个部分,并且它不识别类型T.IGenericRepository <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);
}
}
任何人都可以看到我失踪了吗?
谢谢,固定它。代码来自此博客文章https://codefizzle.wordpress.com/2012/07/26/correct-use-of-repository-and-unit-of-work-patterns-in-asp-net-mvc/和他的代码中有一个错字。 –