1. Introduction (前言) - wezmag/AspNetIdentityDbFirst GitHub Wiki

By default, ASP.Net Identity uses code first approach to manage database.

Sometime we would like to use database first approach, it would be very difficult to do so.

Many tutorials out there accomplish this by creating 2 database context, IdentityDbContext and the one created by db first.

I did not like this kind of approach, so I spent a couple of nights, looked into the source code of ASP.Net Identity.

Finally, I came out with this project. So that we can easily using ASP.Net Identity with database first approach.

有用過ASP.Net Identity的人都知道,當建立專案的時候,預設都是使用Code First的方式在建立資料庫。

但是,有些人已經習慣Database First的作業流程,如果想用ASP.Net Identity,很多網路的教學都是透過建立兩個DbContext (IdentityDbContext 跟 Db First建立的DbContext) 在操作資料庫。

我實在很不喜歡明明一個DbContext可以做的事情,為什麼需要兩個來搞,於是,花了兩個晚上的時間,來研究了一下ASP.Net Identity的Source Code,並得到了下面的方式,讓習慣使用Database First的開發人員,也可以簡單使用ASP.Net Identity。