您的位置:首页 > 博客中心 > 数据库 >

SQLITE WITH ENTITY FRAMEWORK CODE FIRST AND MIGRATION

时间:2022-03-14 02:44

Last month I’ve a chance to develop an app using Sqlite and Entity Framework Code First. Before I started with this project, I thought everything will be easy because Sqlite and Entity Framework are both popular framework. Maybe I just need to install some nuget packages and it will work like a charm. But… yes, there is always a ‘but’ later, it’s just not so easy. Especially when I usually work with NHibernate than Entity Framework. The installation doesn’t complete his job when configuring the .config file (or maybe it just happens for me or does the author do it with intentionally?) and the Migration for Sqlite Entity Framework Code First is not supported (please correct me if I’m wrong). There are, of course, commercial products for Sqlite Migration but I prefer an open source framework or something free :). So in this post I would like to write down the steps required when starting a project for Sqlite Entity Framework Code First and how I make my own simple Migration engine.

 

1. Prerequisites

– I will use same example at this previous post . I recommend you to read that post first before starting with this one if you don’t have any experience with Entity Framework Code First. That post is very informative for beginner.
– Starting with Visual Studio 2012, NuGet is included in every edition (except Team Foundation Server) by default. So if you’re using Visual Studio 2010 and still don’t have NuGet then read this post at section 1.2 for

2. Install and configure Sqlite with Entity Framework Code First

– Create a Console project in Visual Studio
– Right click on your project and choose Manage NuGet Packages…

gxlsystem.com,布布扣

热门排行

今日推荐

热门手游