I’ve built an Entity Framework Model from a simple SQLite database using the ‘Entity Data Model Wizard’
This works fine and I’ve been programming aginst it for a while.
However, I’ve just tried to use this SQLite entity framework model as a DataSource for a DataGridView and it cannot see it as a datasource. Everything suggests that this should be possible. Creating a DataSet from the same database works and the DataGridView can use this as a datasource.
I would prefer to use the entity framework but can’t understand why it’s not seeing it as a valid datasource.
Please help!
As requested here is the app.config file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections></configSections>
<system.data>
<DbProviderFactories>
<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>
<system.diagnostics>
<sources>
<!-- This section defines the logging configuration for My.Application.Log -->
<source name="DefaultSource" switchName="DefaultSwitch">
<listeners>
<add name="FileLog" />
<!-- Uncomment the below section to write to the Application Event Log -->
<!--<add name="EventLog"/>-->
</listeners>
</source>
</sources>
<switches>
<add name="DefaultSwitch" value="Information" />
</switches>
<sharedListeners>
<add name="FileLog" type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" initializeData="FileLogWriter" />
<!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
<!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
</sharedListeners>
</system.diagnostics>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
</startup>
<connectionStrings>
<add name="simpleEntities" connectionString="metadata=res://*/GEM.Classes.test1.csdl|res://*/GEM.Classes.test1.ssdl|res://*/GEM.Classes.test1.msl;provider=System.Data.SQLite;provider connection string="data source=E:\simple.db3"" providerName="System.Data.EntityClient" />
</connectionStrings>
</configuration>
As a test I’ve used a very simple database:
CREATE TABLE SETTINGS (
KEY VARCHAR(50) PRIMARY KEY NOT NULL ,
VALUE VARCHAR(255) NULL DEFAULT NULL);
Decided to ditch EF and go with a DataSet which seems to work great.