2013-11-15 35 views
6

經過大量關於ASP.Net Identity的閱讀後,我仍然對新增加到ASP.Net身份驗證系統中的某些東西感到困惑。如何自定義ASP.Net身份

  • 我應該如何使用ASP.Net身份,如果我已經有一個設計的數據庫及其用戶管理表?例如我想將AspNetUsers表映射到我自己的表UserAccounts
  • 我應該如何將這個新系統與現有的ASP.Net MVC應用程序混合?
  • 如果我不想使用代碼優先(Identity使用代碼優先)會怎麼樣?

任何建議將有所幫助。 在此先感謝。

回答

2

不完全的回答你的問題。但你可能想看看這個項目:Visual Studio庫

ASP.NET Identity Database(項目模板)

它可以作爲一個基礎,用於創建數據庫的使用優先開發自定義ASP.NET身份提供商做法。它目前只有Db模式項目模板。不久之後,還會有一個定製的DbFirst身份提供商項目模板,以及它的單元測試。

0

您必須使用實體框架遷移,這裏一些很好的鏈接,可以幫助你:

http://blogs.msdn.com/b/webdev/archive/2013/10/16/customizing-profile-information-in-asp-net-identity-in-vs-2013-templates.aspx

http://www.asp.net/identity/overview/migrations/migrating-an-existing-website-from-sql-membership-to-aspnet-identity

在這個鏈接,您可以從MVC4遷移到MVC5

http://www.asp.net/mvc/tutorials/mvc-5/how-to-upgrade-an-aspnet-mvc-4-and-web-api-project-to-aspnet-mvc-5-and-web-api-2

最後如果你不想使用EF我不'認爲你可以使用身份,asp.net身份需要這些的NuGet包:

的NuGet包

Microsoft.Aspnet.Identity.Core 
    This package contains the core interfaces of ASP.NET Identity. 
    core 

Microsoft.Aspnet.Identity.EntityFramework 
    This package contains the implementation of ASP.NET Identity system which works with Entity Framework. This means that if you use this package then you can store information in a Sql Server database. 

http://blogs.msdn.com/b/webdev/archive/2013/06/27/introducing-asp-net-identity-membership-system-for-asp-net-applications.aspx

相關問題