ASP.NET MVC标识ASPNetUsers表中的多个主键

时间:2015-02-26 13:27:11

标签: asp.net-mvc asp.net-mvc-5 asp.net-identity

使用ASP.NET MVC Identity时,如何在表ASPNetUsers中添加另一个主(复合)键?

通常我会做这样的事情:

[Required]
[Key, Column(Order = 0)]
public int Id { get; set; }
[Required]
[Key, Column(Order = 1)]
public string AccountNo { get; set; }

但我怎么能用身份做到这一点?

以下是我的代码的开头:

public class ApplicationUser : IdentityUser
{
    [Required]
    [Key, Column(Order = 0)]
    public string AccountNo{ get; set; }....

但是当我这样做时,ASPNetUsers表中的Id不再是主键。我需要在哪里/什么做,以便在此表中我将Id和AccountNo作为主键?

0 个答案:

没有答案
相关问题