EF通用类报错 --求大神指导
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Data.SqlClient;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Text;
using System.Transactions;
报错一:“IQueryable<T>”未包含“Update”的定义,并且找不到可接受第一个“IQueryable<T>”类型参数的可访问扩展方法“Update”(是否缺少 using 指令或程序集引用?)
public bool Update<T>(Expression<Func<T, bool>> WhereLambda, Expression<Func<T, T>> UpdateLambda) where T : class
{
_DbContextHandle.Set<T>().Where(WhereLambda).Update<T>(UpdateLambda);
return _DbContextHandle.SaveChanges() > 0;
}
报错二:无法从用法中推断出方法“Queryable.OrderBy<TSource, TKey>(IQueryable<TSource>, Expression<Func<TSource, TKey>>)”的类型参数。
public List<T> GetAll<T>(string Order = null) where T : class
{
return Order != null ? _DbContextHandle.Set<T>().OrderBy(Order).ToList() ?? null : _DbContextHandle.Set<T>().ToList() ?? null;
}