微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

“从实例化的'System.Int64'类型到'System.Int32'类型的指定转换无效”使用Asp .Net自定义标识时

如何解决“从实例化的'System.Int64'类型到'System.Int32'类型的指定转换无效”使用Asp .Net自定义标识时

enter code here

    I am using custom Asp .Net identity,i am getting error while calling
var user = await UserManager.FindAsync( model.UserName,model.Password);
.
"   The specified cast from a materialized 'system.int64' type to the 'system.int32' type is not valid." 
public class imsUser : IdentityUser<long,imsUserLogin,imsUserRole,imsUserClaim>
{
    public async Task<ClaimsIdentity> GenerateUserIdentityAsync(imsUserManager manager)
    {
        
      var userIdentity = await manager.CreateIdentityAsync(
      this,DefaultAuthenticationTypes.ApplicationCookie);
      return userIdentity;
    }
 }

 public class imsUserLogin:IdentityUserLogin<long>{}
 public class imsUserRole:IdentityUserRole<long>{}
 public class imsUserClaim:IdentityUserClaim<long>{}
 public class imsRole:IdentityRole<long,imsUserRole>
 {
    public imsRole() : base() { }
    public imsRole(string name,int branchId,bool isActive)
    {
        this.BranchId = branchId;
        this.IsActive = isActive;           
    }
     public virtual int BranchId { get; set; }
     public virtual bool IsActive { get; set; }
 }


Please help.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。