我無法從Identity擴(kuò)展屬性。這樣做的全部原因是使我的員工數(shù)據(jù)庫與應(yīng)用程序數(shù)據(jù)庫(包括身份信息)集成在一起,并將其用作一個大型數(shù)據(jù)庫。我嘗試遵循此答案,但似乎他們正在使用另一版本的ASP.NET。我正在使用ASP.NET Core,版本:2.0.3這是我ApplicationUser.cs文件的代碼using System;using System.Collections.Generic;using System.Linq;using System.Security.Claims;using System.Threading.Tasks;using Microsoft.AspNetCore.Identity;namespace src.Models{ public class ApplicationUser : IdentityUser { public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager) { var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie); userIdentity.AddClaim(new Claim("FirstName", this.FirstName.ToString())); userIdentity.AddClaim(new Claim("LastName", this.LastName.ToString())); userIdentity.AddClaim(new Claim("JobTitle", this.JobTitle.ToString())); userIdentity.AddClaim(new Claim("Status", this.Status.ToString())); return userIdentity; } string FirstName { get; set; } string LastName { get; set; } string JobTitle { get; set; } string Status { get; set; } int Age { get; set; } }}我在出現(xiàn)錯誤CreateIdentityAsync,并顯示以下錯誤:'UserManager<ApplicationUser>' does not contain a definition for 'CreateIdentityAsync' and no extension method 'CreateIdentityAsync' accepting a first argument of type 'UserManager<ApplicationUser>' could be found (are you missing a using directive or an assembly reference?) [src]和上的錯誤DefaultAuthenticationTypes,錯誤:The name 'DefaultAuthenticationTypes' does not exist in the current context [src]使用ASP.NET Core無法做到這一點,還是我做錯了什么?
- 2 回答
- 0 關(guān)注
- 141 瀏覽
添加回答
舉報
0/150
提交
取消