2017-10-30 12 views
0

私はSystem.Data.SQLite(.NET 4.0をターゲットとする)でエンティティフレームワークを設定しようとしています。私はVisual Studio 2017を使用していますので、利用可能なデザインタイムコンポーネントはありません。EdmGen.exeは1.0.94.0より大きいSystem.Data.SQLiteバージョンでは動作しません

私は手動ですべての設定のために、このガイド時に起こった:以下の項目を含む、

つのフォルダ:私はしかし、私は上記のリンクの指示を次の中から持っているものを要約しますhttps://liiw.blogspot.co.uk/2014/12/sqlite-entity-framework-database-first.html

を:

  • EdmGen.exe
  • EdmGen.exe.config
  • 012( C:\Windows\Microsoft.NET\Framework\v4.0.30319からコピー)
  • x86x64フォルダ、いくつかのテストテーブルを含む、それぞれのSQLite.Interop.dll
  • System.Data.SQLite.dll
  • System.Data.SQLite.EF6.dll
  • System.Data.SQLite.Linq.dll
  • TestDatabase.sqlite自分自身をそれぞれ含みます。
  • gen.bat

次のようにEdmGen.exe.configの内容は次のとおり

<configuration> 
    <system.data> 
     <DbProviderFactories> 
      <remove invariant="System.Data.SQLite"/> 
      <add name="SQLite Data Provider" invariant="System.Data.SQLite" 
       description=".Net Framework Data Provider for SQLite" 
       type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" /> 
     </DbProviderFactories> 
    </system.data> 
</configuration> 

次のようにgen.batの内容は次のとおり

EdmGen.exe /mode:fullgeneration /c:"Data Source=TestDatabase.sqlite" /provider:System.Data.SQLite /entitycontainer:TestDatabase /project:TestDatabase /language:CSharp 

gen.batを実行している(または上記のコマンド) System.Data.SQLiteバイナリはSystem.Data.SQLiteの最新バージョン1.0.94.0より大きくrsion)は、次のエラーを生成します。

error 7001: The provider returned schema mapping information that is not valid. 
     Schema specified is not valid. Errors: 
StoreSchemaDefinition(2,65) : error 0175: The specified store provider cannot be found in the configuration, or is not valid. 

それはSystem.Data.SQLiteアセンブリのバージョン1.0.94.0で動作します。

エラーの原因を特定しても、私が遭遇している問題についての回答は得られませんでした。ここで間違っているのは何ですか?

答えて

0

だから私は行ってa ticket on system.data.sqlite.orgを開いて、それは彼らがオブジェクトを生成するために働いていた次の指示を提供EdmGen.exeは、Entity Frameworkの6をサポートしていないことが判明:

The EdmGen tool is apparently not compatible with EF6. Instead, you will want to use the legacy provider, which is System.Data.SQLite.Linq.

In the "EdmGen.exe.config" file, use:

<configuration> 
    <system.data> 
     <DbProviderFactories> 
      <remove invariant="System.Data.SQLite" /> 
      <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" /> 
      <remove invariant="System.Data.SQLite.Linq" /> 
      <add name="SQLite Data Provider (LINQ)" invariant="System.Data.SQLite.Linq" description=".NET Framework Data Provider for SQLite (LINQ)" type="System.Data.SQLite.Linq.SQLiteProviderFactory, System.Data.SQLite.Linq" /> 
     </DbProviderFactories> 
    </system.data> 
    <system.diagnostics> 
     <trace autoflush="true" indentsize="4"> 
     <listeners> 
      <add name="myListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="TextWriterOutput.log" /> 
      <remove name="Default" /> 
     </listeners> 
     </trace> 
    </system.diagnostics> 
</configuration> 

And then in the "gen.bat" file:

EdmGen.exe /mode:fullgeneration /c:"Data Source=TestDatabase.sqlite" /provider:System.Data.SQLite.Linq /entitycontainer:TestDatabase /project:TestDatabase /language:CSharp 

The "EdmGen.exe.config" file above will also generate a trace log file in the current directory, which may be useful in debugging. You can remove that section if you like.

は、残念ながら私は認識していませんよEntity Framework 6のオブジェクトを生成する方法について説明します。一般的にはEntity Frameworkの新機能ですので、Entity Framework 6と以前のバージョンのEntity Frameworkの違いについてはあまり知識がありません。それでも、将来的にこの問題に遭遇した他の人には、この回答が役立つはずです。

関連する問題