Ticket Hash: | d6e1fdba1e2b1f5ce470aa7386f129fa6df442e6 | ||
Title: | EdmGen.exe won't work with a System.Data.SQLite version greater than 1.0.94.0 | ||
Status: | Closed | Type: | Incident |
Severity: | Important | Priority: | Medium |
Subsystem: | LINQ | Resolution: | Works_As_Designed |
Last Modified: |
2017-11-11 17:23:20 7.43 years |
Created: |
2017-10-31 08:24:17 7.47 years |
Version Found In: | 1.0.95.0+ |
User Comments: | ||||
anonymous added on 2017-10-31 08:24:17:
I've been trying to set up entity framework with System.Data.SQLite (targeting .NET 4.0). I'm using Visual Studio 2017, so I know there are no design time components available. I happened upon this guide for manually setting everything up: https://liiw.blogspot.co.uk/2014/12/sqlite-entity-framework-database-first.html I will however summarise what I've got from following the instructions in the link above: A single folder, containing the following items:
The content of gen.bat is as follows: EdmGen.exe /mode:fullgeneration /c:"Data Source=TestDatabase.sqlite" /provider:System.Data.SQLite /entitycontainer:TestDatabase /project:TestDatabase /language:CSharp
Running gen.bat (or the command above) with the System.Data.SQLite binaries being the latest version of System.Data.SQLite (or any version greater than 1.0.94.0) produces the following error:
It works with version 1.0.94.0 of the System.Data.SQLite assemblies. Googling the errors has not turned up any answers as to the problem I am experiencing. What is it that I am doing wrong here? I also posted this as a Question on Stackoverflow yesterday: https://stackoverflow.com/questions/47025852/edmgen-exe-wont-work-with-a-system-data-sqlite-version-greater-than-1-0-94-0I am hoping that I have supplied all the necessary information here, but if any more is required then I shall endeavour to provide it. I've also done my best to try and ensure the text of this post is formatted correctly. mistachkin added on 2017-11-01 00:24:47: Ok. I've managed to figure out why you are hitting this error. 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. anonymous added on 2017-11-11 13:15:07: Sorry for taking a long time to get back to you. What you suggest does work for generating the entity framework objects, however based on what you're saying, it sounds like the generated objects are not the EF6 ones (unless I've misinterpreted you)? Do you know of any way to generate the EF6 objects for System.Data.SQLite outside of Visual Studio? I apologise if my questions are dumb here, as I'm afraid I'm fairly new to entity framework. mistachkin added on 2017-11-11 17:23:20: I don't really use EF6 myself and I'm not sure how to generate the objects outside of Visual Studio. |