Code First ctp5 example that works with SQLite

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
iguanamind
Posts: 8
Joined: Mon 28 Feb 2011 22:34

Code First ctp5 example that works with SQLite

Post by iguanamind » Mon 28 Feb 2011 22:50

I'm looking for a Code First ctp5 example that works with SQLite. I have been killing myself over the last few days. Anyone have any code samples with the connection string as well. It seems that I am having issues with not using the required Metadata keyword correctly. But even there I am not sure because I am don't know how this all works together. I need a working example really.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Wed 02 Mar 2011 09:57

Take a look at this article, it deals with Code First support peculiarities in dotConnects.
The sample is available for download here.

iguanamind
Posts: 8
Joined: Mon 28 Feb 2011 22:34

sample

Post by iguanamind » Thu 03 Mar 2011 15:46

First off, thanks for replying. And the example is pretty extensive and helpful compared to anything else I have seen on the subject. The problem is that it doesn't work. It compiles. And I have spent a couple hours trying to get it to run but it doesn't. I am still trying to find the source of the problem, but this is the exception:

{"SQLite error\r\nno such table: TEST.Company"}

Any ideas?

iguanamind
Posts: 8
Joined: Mon 28 Feb 2011 22:34

fixed it

Post by iguanamind » Thu 03 Mar 2011 16:17

I figured it out. The default schema for the MySqliteContext class is "Main", but the SchemaName for the Entities in Entities.cs is "TEST". Cracked open the sqlite file to verify the database name is "Main". I changed the schemaname for all of the Entities to "Main", works fine.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Thu 03 Mar 2011 16:42

Glad to hear the issue is resolved.

Post Reply