In my previews blog post we have seen how using a simple “data provider” provided by http://sqlite.phxsoftware.com/ can make our life easier in context of SQLite in .net. In this short article we are going to see how we can use SQLite to generate Entity Framework Data model.
Choosing the Provider
First thing first create any type of project in Visual studio 2010. But I would prefer an web application or windows forms or perhaps a WPF application. Now click on project and select add new item to add a new item type. From Add new item wizard select “Ado.net Entity Data Model” and click on add this will brought up the Entity data model wizard.
- Step 1: Select Generate from Database
- Step 2: In next window select New connection
- Step 3: Connection properties window will popup and the select right kind of provider for SQLite.
- Step 4: After that the Connection properties will have browser or New db,
- Step 5: Now select existing db if you have using browser or New to create new db.
- Step 6: Continue with the wizard to select database table items to include in model.
- Step 7: Click finish to close the wizard and a data model will be generated for you.
If you had any relationship in the database those will be automatically be synchronized in data model, that’s it we are good to jump in the code to retrieve data and do all type of necessary stuff that we must do in a database. Best of luck and happy coding.