I have used code first method before, but somehow I could not think of a way in making my Code First works. I have developed the POCO and DbContext. But now I am stuck on how to get the database created and subsequently used in my application. Do I need to add something in the project?
-
Creating a database from Code First is covered in basically every EF Code First howto out there -- what part are you having problems with?Cory Nelson– Cory Nelson2013-11-09 08:32:16 +00:00Commented Nov 9, 2013 at 8:32
-
I want to use it with SQLite but somehow I cannot find guide on how to setup the configuration, the connection string and how to make the application create the database.Haikal Nashuha– Haikal Nashuha2013-11-09 08:45:03 +00:00Commented Nov 9, 2013 at 8:45
Add a comment
|
1 Answer
Currently default provider System.Data.SQLite doesn't support database creation. To have ability to create database programatically from your POCO model objects you need to consider to use for example Devart's SQLite provide. But this is paid solution.
For more information see answer for the following stack overflow question.
3 Comments
Haikal Nashuha
That is exactly what I am looking for. Do you know if SQLite themselves are updating this issue? I hate having to do it Model-First way.
Maxim Kornilov
@HaikalNashuha I don't fully understand question in your comment. Basically I don't know if SQLite themselves update issue or not. May be one of the solution is to look in other MicroOrm if you don't require all features which EF provides. For example ServiceStack.OrmiLite. It supports Code First approach, works with SqlLite. But be sure to check the licence (it was changed month ago). Currently it is still can be used. But project are going to become commercial one.
Haikal Nashuha
I just checked it out and still there is no database creation if I am to use System.Data.SQLite. If I want to use this provider, the best way is to go Model-First.