ASP.Net.Core 2.2 Identity将ID从字符串改为整数
创始人
2024-09-17 02:30:37
0

在ASP.Net Core 2.2 Identity中,可以通过自定义User类来将ID从字符串改为整数。以下是一个解决方案的代码示例:

  1. 创建一个自定义的User类,继承自IdentityUser
public class ApplicationUser : IdentityUser
{
}
  1. 在Startup.cs文件的ConfigureServices方法中,将默认的IdentityUser类替换为自定义的User类:
services.AddDefaultIdentity()
    .AddEntityFrameworkStores()
    .AddDefaultTokenProviders();
  1. 在DbContext类中将IdentityUser替换为ApplicationUser:
public class ApplicationDbContext : IdentityDbContext
{
    public ApplicationDbContext(DbContextOptions options)
        : base(options)
    {
    }
}
  1. 在Identity的数据库迁移中,将IdentityUser替换为ApplicationUser:
dotnet ef migrations add InitialCreate

这样,你的ASP.Net Core 2.2 Identity中的UserID将会是一个整数类型。

相关内容

热门资讯

wepoker辅助插件功能!w... wepoker辅助插件功能!wepoker辅助器激活码(透视)教程-确实专业是真的挂1、任何wepo...
透视详细!wepoker私人局... 透视详细!wepoker私人局俱乐部怎么进(透视)wpk软件是正规的吗,教程学习(有挂分析)-哔哩哔...
we poker辅助器!hhp... we poker辅助器!hhpoker可以控制牌吗(透视)器-确实曝光存在有挂1.hhpoker可以...
透视解密!wepoker线上大... 透视解密!wepoker线上大神(透视)aapoker透视脚本入口,教程窍门(确实有挂)-哔哩哔哩;...
pokemmo修改器手机版!f... pokemmo修改器手机版!fishpoker透视(透视)器-竟然必备是有挂1、pokemmo修改器...
透视详细!wepoker有没有... 透视详细!wepoker有没有挂(透视)wpk有那种辅助吗,教程积累(有挂透明挂)-哔哩哔哩wpk有...
拱趴大菠萝开挂方法!竞技联盟透... 拱趴大菠萝开挂方法!竞技联盟透视(透视)插件-确实总结真的有挂暗藏猫腻,小编详细说明拱趴大菠萝开挂方...
透视开挂!hhpoker德州挂... 透视开挂!hhpoker德州挂真的有吗(透视)约局吧开挂神器是真的吗,教程模板(有挂工具)-哔哩哔哩...
epoker免费透视脚本!德州... epoker免费透视脚本!德州透视是真的假的(透视)app-都是揭露真的有挂1)德州透视是真的假的辅...
透视科普!fishpoker透... 透视科普!fishpoker透视底牌(透视)wepoker私人辅助器,教程指南书(证实有挂)-哔哩哔...