【发布时间】:2014-10-21 08:12:55
【问题描述】:
我是 SQLite 的新手。
我想查询我的 SQLite 数据库以获取多行。
当我在本地数据库中添加新项目时,我将此方法称为 Add:
public bool Add<T>(string key, T value)
{
return this.Insert(new SQliteCacheTable(key, this.GetBytes(value))) == 1;
}
_simpleCache.Add("favorite_1", data1);
_simpleCache.Add("favorite_2", data2);
_simpleCache.Add("favorite_3", data2);
那么,
我想从本地数据库中检索键以“favorite_”开头的所有条目 返回数据库中所有“最喜欢”的对象。
我在 Linq 方面经验丰富,我想做这样的事情:
IEnumerable<Element> = repository.Find((element) => element.Key.StartWith("favorite_"))
SQLiteConnection 类中有这样一个方法:
SQLite.Net.SQLiteConnection.Find<T>(System.Linq.Expressions.Expression<System.Func<T,bool>>)
但我希望与 in 返回集合 IEnumerable<T> 相同。
你能帮帮我吗?
谢谢。
乔尔
【问题讨论】: