2016-08-30 12 views
0

Sqlite.Net Extensionsライブラリを使用してデータベースからオブジェクトを取得しています。Sqlite.Net拡張機能の使用方法

私はId'sのリストを持っており、私のリストにそのIDが含まれているデータベースからすべてのオブジェクトを取得したいと考えています。

私は以下の持っている:

var filteredCalls = listOfIds;    
var conn = Databsae.Connection; 
var NewCalls = conn.GetAllWithChildren<Call>(x => filteredCalls.Any(y => y == x.Id)); 

をしかし、このコードはエラーを返します:

[ERROR] FATAL UNHANDLED EXCEPTION: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NotSupportedException: Cannot compile: Lambda 08-30 15:46:57.210 E/mono-rt (16849): at SQLite.Net.TableQuery 1[T].CompileExpr (System.Linq.Expressions.Expression expr, System.Collections.Generic.List 1 queryArgs) [0x007aa] in :0 08-30 15:46:57.210 E/mono-rt (16849): at SQLite.Net.TableQuery 1[T].CompileExpr (System.Linq.Expressions.Expression expr, System.Collections.Generic.List 1 queryArgs) [0x001a5] in :0 08-30 15:46:57.210 E/mono-rt (16849): at SQLite.Net.TableQuery 1[T].GenerateCommand (System.String selectionList) [0x0006d] in <filename unknown>:0 08-30 15:46:57.210 E/mono-rt (16849): at SQLite.Net.TableQuery 1[T].GetEnumerator() [0x00008] in :0 08-30 15:46:57.210 E/mono-rt (16849): at System.Collections.Generic.List 1[T]..ctor (IEnumerable 1 collection) [0x00073] in /Users/builder/data/lanes/3540/1cf254db/source/mono/external/referencesource/mscorlib/system/collections/generic/list.cs:98 08-30 15:46:57.210 E/mono-rt (16849): at System.Linq.Enumerable.ToList[TSource] (IEnumerable 1 source) [0x00011] in /Users/builder/data/lanes/3540/1cf254db/source/mono/external/referencesource/System.Core/System/Linq/Enumerable.cs:835 08-30 15:46:57.210 E/mono-rt (16849): at SQLiteNetExtensions.Extensions.ReadOperations.GetAllWithChildren[T] (SQLite.Net.SQLiteConnection conn, System.Linq.Expressions.Expression 1 filter, Boolean recursive) [0x00015] in /Users/redent/Documents/workspace/sqlite-net-extensions/SQLiteNetExtensions/Extensions/ReadOperations.cs:60

それでは、どのように私はそれがクラッシュすることなくGetAllWithChildren方法を使用することが出来るのですか?ドキュメントは

エクストラ

かなりまばらであるこれは、このような場合には、この方法がいかに代替/何であるhereを述べたようにおそらく、ラムダ式はSqliteをでサポートされていないline where the method is implemented

です使用されるはずですか?

答えて

0

だから、Sqlite.Netは、別のlamdba式にネストされたラムダ式に対処できなかったようです。したがって、フィルタを次のように変更しました:

var NewCalls = conn.GetAllWithChildren<DiaryCall>(x => filteredCalls.Contains(x.Id)); 
関連する問題