I am trying to customize IdentityUser class in asp.net identity.
public class ApplicationUser : IdentityUser
{
public ApplicationUser()
{
IsBlocked = false;
}
public bool IsBlocked { get; set; }
}
The problem is: when using code first migrations, the additional field is created nullable. The same if I drop database and recreate it.
CREATE TABLE [dbo].[AspNetUsers] (
[Id] NVARCHAR (128) NOT NULL,
[UserName] NVARCHAR (MAX) NULL,
[PasswordHash] NVARCHAR (MAX) NULL,
[SecurityStamp] NVARCHAR (MAX) NULL,
[IsConfirmed] BIT NOT NULL,
[IsBlocked] BIT NULL,
[Discriminator] NVARCHAR (128) NOT NULL,
CONSTRAINT [PK_dbo.AspNetUsers] PRIMARY KEY CLUSTERED ([Id] ASC)
);
How can I fix this?
I have boolean fields in other classes on the same DbContext, and they are all created not null (as they should).