VS 2012默認是不帶的SQLite的Data Provider,所以無法直接在VS 2012里管理SQLite的數據庫,自然也不能在VS里像SQL Server那樣直接生成Entity Framework的model類了。SQLite團隊為了解決這個問題,在SQLite的安裝包里把用於VS2012的Data Provider給打包進去了。但是擼主卻失敗了無數次才找到正確把SQLite整合到VS里的方法,記錄如下,分享給有需要的童鞋。
- 首先從http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki下載SQLite安裝包。這個頁面安裝包非常多,一下子就會看眼花繚亂。需要注意的是只有32位的安裝包才會能把SQLite的Data Provider加到VS Designer里。如果你已經看的眼花繚亂,一個簡單的方法就是搜索右邊描述里有顯示如下黑體語句的This is the only setup package that is capable of installing the design-time components for Visual Studio 2012的安裝包,直接下載安裝就行。擼主這次下載到的文件名是sqlite-netFx45-setup-bundle-x86-2012-1.0.93.0.exe。
- 安裝的時候一定不要用Full Installation,要選擇Custom Installation,然后只選擇Core Component(包括它里面的2個) 以及Visual Studio Designer Component。
- 點擊下一步,在Install Designer For Visual Studio 2012前面打鈎
- 安裝完畢后,重啟VS 2012后就應該能看到SQLite Data Provider的選項了。
2014.8.10更新,Visual Studio 2013里啟用SQLite Data Provider的步驟是一樣的,就是下載安裝包的時候要選擇This is the only setup package that is capable of installing the design-time components for Visual Studio 2013左邊的那個安裝包。