Creating a new database with EF code first

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for SQLite
Post Reply
Morganski
Posts: 1
Joined: Tue 18 Dec 2012 23:43

Creating a new database with EF code first

Post by Morganski » Wed 19 Dec 2012 00:01

Does the DevArt SQLite provider support creation of databases?

I'm using EF code first but each time I try to create a database I'm getting a first chance exception "DatabaseExists is not supported by the provider". This is coming from System.Data.Common.DbProviderServices, and it looks as if the SQLiteProviderServices class does not override the appropriate member to support database creation.

So, I just want clarification that the current SQLite provider does not permit databases to be constructed and I'll have to generate the schema by hand.

Thanks in advance,

Morgan

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Creating a new database with EF code first

Post by Shalex » Fri 21 Dec 2012 12:40

Please use the SQLiteEntityProviderServices class from the Devart.Data.SQLite.Entity namespace instead of the SQLiteProviderServices class.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Creating a new database with EF code first

Post by Shalex » Mon 24 Dec 2012 14:22

The Devart.Data.SQLite.Entity.SQLiteEntityProviderServices class will be used automatically if the context connects to the database via Devart.Data.SQLite isntead of System.Data.SQLite. So make sure that you have set a connection string via Devart.Data.SQLite in the config file with the name which is the same as the name of the context if you are using a default constructor. Or specify the connection object explicitly when creating the context.

Post Reply