новый столбец и ограничения добавляются в таблицу с помощью миграции с ядром ef - PullRequest
1 голос
/ 24 марта 2020

У меня есть класс, который реализует IdentityUserClaim <>, но когда я выполняю миграцию, добавляется столбец с именем UserId1. И я не могу понять, почему я не могу найти ссылку на этот столбец. В таблице уже есть столбец с именем UserId

UserClaim :

public class UserClaim : IdentityUserClaim<int>
{
    public UserClaim() { }

    public UserClaim(int userId, string type, string value, int? siteId) : this(userId, new Claim(type, value), siteId) 
    {
        this.SiteId = siteId;
    }

    public UserClaim(int userId, Claim claim, int? siteId) {
        this.UserId = userId;
        this.SiteId = siteId;
        this.ClaimType = claim.Type;
        this.ClaimValue = claim.Value;
    }

    [PersonalData]
    public bool Active { get; set; } = true;
    [PersonalData]
    public Guid UId { get; set; } = Guid.NewGuid();
    public int? SiteId { get; set; }
    [PersonalData]
    public DateTime DateCreated { get; set; } = DateTime.Now;
    [PersonalData]
    public DateTime? DateDeleted { get; set; }

    [NotMapped]
    public Claim Claim => new Claim(this.ClaimType, this.ClaimValue);
}

Таблица:

CREATE TABLE [dbo].[IdentityUserClaim](
    [Id] [int] IDENTITY(1,1) NOT NULL,
    [UserId] [int] NOT NULL,
    [ClaimType] [nvarchar](max) NULL,
    [ClaimValue] [nvarchar](max) NULL,
    [Active] [bit] NOT NULL,
    [UId] [uniqueidentifier] NOT NULL,
    [SiteId] [int] NULL,
    [DateCreated] [datetime2](7) NOT NULL,
    [DateDeleted] [datetime2](7) NULL,
    [UserId1] [int] NULL,

enter image description here

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...