2016-11-28 9 views
1

「デバッグ」モードでSQLiteを使用してアプリケーションを開発していて、完璧に動作しました。UWP - ネイティブでコンパイルするとSQLiteの問題が発生する

UWPがRe​​flexionをサポートしていないように見えますが、これを「リリース」(「Native」をコンパイルする)しようとすると問題が発生しました。

私は現在、このパッケージを使用しています。たとえば

SQLite.Core.UAP 
SQLite.Net-PCL 

、私はこれをしようとします

ILTransform_0027: Method 'CreateLambda' within 'System.Linq.Expressions.Expression' could not be found. 


Error at SerializationAssemblyGenerator.Program.AddKnownContractsLists(McgCodeTypeDeclaration container, ContractTables tables) 


Severity Code Description Project File Line Suppression State 
Error  at SerializationAssemblyGenerator.Program.GenerateDataContractSerializerHelperCode(IEnumerable`1 contracts, IEnumerable`1 jsonContracts, IEnumerable`1 wcfSerializers) 



ILTransform_0000:  MCG : warning MCG0006: Unresolved P/Invoke method '_TPM_Init!tpm.dll' in assembly 'TSS.UWP, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' because it is not available in UWP applications. Please either use an another API , or use [DllImport(ExactSpelling=true) 

private void CreateDatabase() 
    { 
     var dbPath = Path.Combine(ApplicationData.Current.LocalFolder.Path, "StoredEvents.sqlite"); 
     SQLiteConnection SQLiteConn = new SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), dbPath, false); 

     SQLiteConn.CreateTable<StoredEvents>();    
    } 

これらはエラーの一部ですコードをどのようにリファクタリングすればよいですか?

別のライブラリを使用する必要がありますか?

答えて

0

私は、SilverlightからUWPに自分のアプリケーションをアップデートしていたときと同じ問題がありました。私は、UWPのためのSQLliteがWindows 10の展開に利用可能であると言っているどこかの記事を読んでみました(見つけようとしましたが、できませんでした)。

enter image description here

上記はVS拡張機能です。あなたはツールからそこに行くことができます - >>拡張子&更新

以下は私の参照がどのように見えるかです。また

enter image description here

私はあなたのDB接続をクローズしていないことに気づきました。 usingステートメント内で使用する方が良い。 CreateTables()は次のようになります。

private void CreateDatabase() 
{ 
    var dbPath = Path.Combine(ApplicationData.Current.LocalFolder.Path, "StoredEvents.sqlite"); 
    using (SQLiteConnection SQLiteConn = new SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), dbPath, false)) 
    { 
     SQLiteConn.CreateTable<StoredEvents>(); 
    }  
} 
関連する問題