Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

New column added for table when inhereting IdentityUserClaim

$
0
0

I have a basic class that inherits IdentityUserClaim<int>. When I do a migration it adds a column named UserId1, but this column isn't visible any other place. The bad thing is that when calling RoleManager.GetClaimsAsync(User) it references this column when the rest of the system uses the standard UserId column.

Class:

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);
}

Table:

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,


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>