Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/16.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
Asp.net mvc 将MVC核心标识与其他数据库优先表集成_Asp.net Mvc_Entity Framework_Identity_Database First - Fatal编程技术网

Asp.net mvc 将MVC核心标识与其他数据库优先表集成

Asp.net mvc 将MVC核心标识与其他数据库优先表集成,asp.net-mvc,entity-framework,identity,database-first,Asp.net Mvc,Entity Framework,Identity,Database First,我使用的是MVC核心和默认的个人用户身份验证。 我将FullName字段添加到AspNetUsers表中,它工作正常。 我需要在我的表与AspNetUsers表中的id字段之间创建一个关系,以便获得用户的全名 我不知道如何在实体框架中创建关系,我尝试在ApplicationUser类中添加以下内容 public class ApplicationUser : IdentityUser { public string FullName { get; set; } publi

我使用的是MVC核心和默认的个人用户身份验证。 我将FullName字段添加到AspNetUsers表中,它工作正常。 我需要在我的表与AspNetUsers表中的id字段之间创建一个关系,以便获得用户的全名

我不知道如何在实体框架中创建关系,我尝试在ApplicationUser类中添加以下内容

  public class ApplicationUser : IdentityUser
{

    public string FullName { get; set; }

    public mytable T { get; set; }
}

在mytable模型中,我添加了以下内容

公共虚拟ICollection应用程序用户{get;set;}

不幸的是,我遇到以下错误:

实体类型“IdentityUserLogin”需要定义主键


有什么想法吗

通过以下链接解决的第一个问题

IdentityUserLogin'需要定义主键,也需要通过


您是先使用代码还是先使用数据库?@hasan我先使用数据库,我制作了脚手架,然后迁移了ApplicationDbContext。您可以使用stackoverflow.com/a/20669370/3089009,但这不起作用