scaffolder เพื่อแสดงไฟล์ Register , Login , Logout

Configure Identity services

ติดตั้ง ASP.NET Core scaffolder

[code]
> dotnet tool install -g dotnet-aspnet-codegenerator
[/code]

เข้าไปใน project directory แล้วทำการ add package Microsoft.VisualStudio.Web.CodeGeneration.Design

[code]
> dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design
> dotnet restore
[/code]

สั่ง scaffolder

ข้อควรระวังคือ -dc webAppIdentity.Data.ApplicationDbContext ต้องเป็นชื่อโปรเจ็กส์ที่ถูกต้องทั้งตัวพิมพ์เล็กพิมพ์ใหญ่
ไม่งั้นตอนรันจะ error ฟ้องว่ามี 2 schema

แสดงไฟล์ที่เกี่ยวข้องกับ Account.Register , Account.Login , Account.Logout ออกมา

[code]
> dotnet aspnet-codegenerator identity -dc webAppIdentity.Data.ApplicationDbContext –files "Account.Register;Account.Login;Account.Logout"
[/code]

หรือ scaffolder ไฟล์ทั้งหมดออกมาเลย (เยอะมาก)

[code]
> dotnet aspnet-codegenerator identity -dc webAppIdentity.Data.ApplicationDbContext
[/code]

แต่อย่าลืมกำหนดชื่อโปรเจ็กส์ด้วยนะ ในที่นี้ใช้ webAppIdentity

Areas/identity/Pages/Account/Register.cshtml.cs

Areas/identity/Pages/Account/Login.cshtml.cs

Areas/identity/Pages/Account/Logout.cshtml.cs

รายชื่อไฟล์ที่สามารถเรียกออกมาได้

[code]
Account.Register
Account.Login
Account.Logout

Account.AccessDenied
Account.ConfirmEmail
Account.ExternalLogin
Account.ForgotPassword
Account.ForgotPasswordConfirmation
Account.LoginWith2fa
Account.LoginWithRecoveryCode
Account.ResetPassword
Account.ResetPasswordConfirmation

Account.Manage.ChangePassword
Account.Manage.DeletePersonalData
Account.Manage.Disable2fa
Account.Manage.DownloadPersonalData
Account.Manage.EnableAuthenticator
Account.Manage.ExternalLogins
Account.Manage.GenerateRecoveryCodes
Account.Manage.Index
Account.Manage.PersonalData
Account.Manage.ResetAuthenticator
Account.Manage.SetPassword
Account.Manage.TwoFactorAuthentication
[/code]

 

Link