几天前,我发现了Ben Foster关于MVC,Identity和OWIN的非常好的教程。本教程是here尝试覆盖ClaimsIdentityFactory上的CreateAsync函数
我刚刚完成教程,并且发现尝试覆盖函数“CreateAsync”的问题。 Visual Studio不允许这样做。
这是代码:
public class AppUserClaimsIdentityFactory : ClaimsIdentityFactory<AppUser>
{
public override async Task<ClaimsIdentity> CreateAsync(
UserManager<AppUser> manager,
AppUser user,
string authenticationType)
{
var identity = await base.CreateAsync(manager, user, authenticationType);
identity.AddClaim(new Claim(ClaimTypes.Country, user.Country));
return identity;
}
}
任何人都知道我怎样才能解决这个问题呢?
解决方案
由于@ETorre,这是最后的代码!
public class AppUserClaimsIdentityFactory : ClaimsIdentityFactory<AppUser, string>
{
public async override Task<ClaimsIdentity> CreateAsync(UserManager<AppUser, string> manager,
AppUser user, string authenticationType)
{
var identity = await base.CreateAsync(manager, user, authenticationType);
identity.AddClaim(new Claim(ClaimTypes.Country, user.Country));
return identity;
}
}
您可以将代码附加为文本代替。没有人想调试代码的图片。 – Matthew 2014-10-08 14:04:51
谢谢,我刚刚将代码附加为文本。 @Matthew – 2014-10-08 14:13:39