オーバーライドボイドParseEntityに追加し、次のエラーメッセージを取得しようとすると:ASP.NET IDのApplicationUserをオーバーライドすることは可能ですか?
重大度コード説明プロジェクトファイルの行の抑制状態 エラーCS0115「ApplicationUser.ParseEntity(REF ApplicationUser)」:上書きすることが分かっていない適切な方法を... 。
public override void ParseEntity(ref ApplicationUser entity)
{
entity.Email = Email;
entity.UserName = Email;
entity.FirstName = FirstName;
entity.LastName = LastName;
entity.UserTypeID = UserTypeID;
entity.ModifiedDate = DateTime.Now;
entity.ModifiedBy = Id;
}
を私IdentityModel.csに:\モデル\ IdentityModels.cs 47アクティブ
は、私が追加しようとしています。次のようにApplicaionUserに見える:
public class ApplicationUser : IdentityUser<string, ApplicationUserLogin, ApplicationUserRole, ApplicationUserClaim>
{
public ApplicationUser()
{
this.Id = Guid.NewGuid().ToString();
// Add any custom User properties/code here
}
[Display(Name = "First Name")]
[Required]
public string FirstName { get; set; }
[Display(Name = "Last Name")]
[Required]
public string LastName { get; set; }
[Display(Name = "Guarantee Limit")]
public Nullable<double> GuaranteeLimit { get; set; }
[Display(Name = "User Type")]
public int UserTypeID { get; set; }
[Display(Name = "Terms And Conditions Version")]
public string TermsAndConditionsVersion { get; set; }
[Display(Name = "Last Terms And Conditions Date")]
public DateTime ? LastTermsAndConditionsDate { get; set; }
[Display(Name = "Last Login Date And Time")]
public DateTime ? LastLoginDateTime { get; set; }
[Display(Name = "Created Date")]
public DateTime CreatedDate { get; set; }
[Display(Name = "Modified Date")]
public DateTime ? ModifiedDate { get; set; }
[Display(Name = "Modified By")]
public string ModifiedBy { get; set; }
/////////////////I want to add the override here/////////////////
public async Task<ClaimsIdentity> GenerateUserIdentityAsync(ApplicationUserManager manager)
{
// Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
// Add custom user claims here
return userIdentity;
}
}
は、私がここにオーバーライドを追加することができAMまたは私は何かが足りないのですか?私はいくつかの投稿として見て、System.Web.Mvcを使用して追加することをお勧めしましたが、これは同じエラーメッセージでは違いはありません。
「ParseEntity」メソッドはどこにもありません。 'override'を削除して、それを使用したい場合は問題ありません。 – trailmax