From: 011netservice@gmail.com
Date: 2023-06-01
Subject: Custom Identity for ASP.NET Core Web Application MVC, .NET 6.0.
本文網址 | 原始碼 | 舊版原始碼, Visual Studio 2022, NET Framework 4.8 |
本文說明 如何客製化 Visual Studio 2022 ASP.NET Core Web Application MVC Individual Account .NET 6.0 網站中的 Identity, 取消使用 Microsoft.AspNetCore.Identity.EntityFrameworkCore, SQL Server Express LocalDB 資料庫, 改為 MySql 資料庫

歡迎來信交流, 訂購軟體需求.

依照專案樣板(ASP.NET Core Web App (Model-View-Controller), .NET 6.0 (Long Term Support), Individual Accounts, HTTPS) 產生原始碼後, 建議再將收藏在 Microsoft.AspNetCore.Identity.UI NuGet 中的 Scaffold Razor Page 全部取出, 以便取得較多的客製化範圍.
參考 如何取得 Scaffold Razor Pages 說明, 或是直接下載 已取出所有的 Scaffold Razor Pages 專案範本
本文後續說明, 就從這裡開始, 一開始的專案檔案清單如下圖.



在專案項目上按滑鼠右鍵, 選擇 Add.New Scaffolded item...



畫面 Add New Scaffolded item 中選擇 Identity 後再 Add.



畫面 Add Identity 中填入:
Override all files: Checked.
DbContext class: ApplicationDbContext (ASPNETCoreWebAppMvcIAScaffold1.Data), 也就是下拉選單中唯一的項目.
Database provider: SQL Server
User class: blank.
按下方按鍵 Add.



專案中已新增檔案, 例如: Areas\Identiy\Pages\Acount\*.cshtml



開放時間 09:00 ~ 18:00 |  🛈 |   |   |