0

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?

2
  • Creating a database from Code First is covered in basically every EF Code First howto out there -- what part are you having problems with? Commented 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. Commented Nov 9, 2013 at 8:45

1 Answer 1

0

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.

Sign up to request clarification or add additional context in comments.

3 Comments

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.
@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.
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.