Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 构建数据库后,Guid不是外键。ASP.NET核心标识3.1_C#_Asp.net Identity_Asp.net Core 3.1 - Fatal编程技术网

C# 构建数据库后,Guid不是外键。ASP.NET核心标识3.1

C# 构建数据库后,Guid不是外键。ASP.NET核心标识3.1,c#,asp.net-identity,asp.net-core-3.1,C#,Asp.net Identity,Asp.net Core 3.1,我在这里使用ASP.NET标识,但我有一些问题,我想用一些属性扩展它。我添加了类应用程序user,它继承自identity用户 public class UserInfo : IdentityUser { public virtual UserProfileInfo ProfileInformation { get; set; } } public class UserProfileInfo { [Key] public int Id { get; set; }

我在这里使用ASP.NET标识,但我有一些问题,我想用一些属性扩展它。我添加了类应用程序user,它继承自identity用户

public class UserInfo : IdentityUser 
{
    public virtual UserProfileInfo ProfileInformation { get; set; }
}

public class UserProfileInfo 
{
    [Key]
    public int Id { get; set; }
    public string FirstName { get; set; }
    public string LastName { get; set; }
}
My
DbContext

public class MISDBContext : IdentityDbContext<UserInfo> 
{
    public MISDBContext(DbContextOptions<MISDBContext> options)
        : base(options) { }

    public DbSet<MISObject> MISobject { get; set; }
    public DbSet<ApplicationUser> AppUsers { get; set; }

    protected override void OnModelCreating(ModelBuilder modelBuilder) 
    {
        base.OnModelCreating(modelBuilder);
    }
}
我的Startup.cs

public void ConfigureServices(IServiceCollection services) {
     services.AddDbContext<MISDBContext>
      (options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
        services.AddDbContext<ApplicationDbContext>(options =>
            options.UseSqlServer(
                Configuration.GetConnectionString("DefaultConnection")));
        services.AddDefaultIdentity<IdentityUser>(options => options.SignIn.RequireConfirmedAccount = true)
            .AddEntityFrameworkStores<ApplicationDbContext>();
             
        services.AddControllersWithViews();
        services.AddRazorPages();
    }
public void配置服务(IServiceCollection服务){
services.AddDbContext
(options=>options.UseSqlServer(Configuration.GetConnectionString(“DefaultConnection”));
services.AddDbContext

public void ConfigureServices(IServiceCollection services) {
     services.AddDbContext<MISDBContext>
      (options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
        services.AddDbContext<ApplicationDbContext>(options =>
            options.UseSqlServer(
                Configuration.GetConnectionString("DefaultConnection")));
        services.AddDefaultIdentity<IdentityUser>(options => options.SignIn.RequireConfirmedAccount = true)
            .AddEntityFrameworkStores<ApplicationDbContext>();
             
        services.AddControllersWithViews();
        services.AddRazorPages();
    }