2017-10-30 5 views
0

.NET Framework 4.0을 대상으로 System.Data.SQLite로 엔티티 프레임 워크를 설정하려고했습니다. 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에서 복사) 각각 몇 가지 테스트 테이블을 포함하는 자신의 각각의 SQLite.Interop.dll
  • System.Data.SQLite.dll
  • System.Data.SQLite.EF6.dll
  • System.Data.SQLite.Linq.dll
  • TestDatabase.sqlite을 포함 3,516,
  • x86x64 폴더.
  • 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의 최신 버전입니다.

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으로 작동합니다) 1.0.94.0 이상 rsion 다음과 같은 오류가 발생합니다.

오류를 검색하면 발생하는 문제에 대한 답변이 표시되지 않았습니다. 내가 여기서 잘못하고있는 것은 무엇입니까?

답변

0

그래서 내가 가서 a ticket on system.data.sqlite.org을 열어 그것은 EdmGen.exe 그들은 개체를 생성하는 일을 다음과 같은 지침을 제공하는 엔티티 프레임 워크 (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의 차이점에 대해 많은 지식을 갖고 있지 않습니다. 그럼에도 불구하고이 답변이 앞으로이 문제가 발생하는 다른 사용자에게 유용 할 것입니다.

관련 문제