public class CellValue { public double? Max; public double? Min; public string Value; public string Annotation; }
//以下在数据库中查找是否具有这样的条件的数据,如果无返回null public T GetOne(Expression<Func<T, bool> predicate) { IQueryable<T> query = this.context.Set<T>(); return query.FirstOrDefault(predicate); }
我在调用时总是返回null值,为什么?
CellValue cell = new CellValue{Max = 0.8, Min = 0.1, Value="test"}; Steel steel = service.GetOne(t=>t.Max == cell.Max && t.Min == cell.Min && t.Value == cell.Value && t.Annotation == cell.Annotation);//Steel具有和CellValue一样的属性,但是返回的steel == null
摇曳的蔷薇