我想通过传递谓词作为参数来获取一定数量的元素。不过,我收到以下错误:将谓词作为参数传递
Cannot implicitly convert type
System.Collections.Generic.IEnumerable < Students.Entities>
tobool
var names = await Task.Run(() => Repository.GetWithNChildren(e => e.Entities.Take(offset)));
public List<T> GetWithNChildren(Expression<Func<T, bool>> predicate = null)
{
var db = _factory.GetConnectionWithLock();
using (db.Lock())
{
return db.GetAllWithChildren(predicate, true);
}
}
GetAllWithChildren
是在SQLite的类
namespace SQLiteNetExtensions.Extensions
{
public static class ReadOperations
{
public static bool EnableRuntimeAssertions;
public static T FindWithChildren<T>(this SQLiteConnection conn, object pk, bool recursive = false) where T : class;
public static List<T> GetAllWithChildren<T>(this SQLiteConnection conn, Expression<Func<T, bool>> filter = null, bool recursive = false) where T : class;
public static void GetChild<T>(this SQLiteConnection conn, T element, string relationshipProperty, bool recursive = false);
public static void GetChild<T>(this SQLiteConnection conn, T element, Expression<Func<T, object>> propertyExpression, bool recursive = false);
public static void GetChild<T>(this SQLiteConnection conn, T element, PropertyInfo relationshipProperty, bool recursive = false);
public static void GetChildren<T>(this SQLiteConnection conn, T element, bool recursive = false);
public static T GetWithChildren<T>(this SQLiteConnection conn, object pk, bool recursive = false) where T : class;
}
}
哪一行有错误 –
第一行有错误 – hotspring
显然,'的IEnumerable'的'。取(返回)'不能被转换为“布尔”。什么是如此令人惊讶? –