如何访问AspNetUsers表字段?

时间:2016-10-20 06:11:20

标签: c# asp.net-mvc visual-studio asp.net-mvc-5 asp.net-membership

我想在asp.net MVC中实现有限时间段的成员资格。为此,我在ExpiryDate表中手动引入了一个新列AspNetUsers。当新用户注册自己时,此字段将在getdate()方法的帮助下自动生成到期日期。

CREATE TABLE [dbo].[AspNetUsers] (
[Id]                   NVARCHAR (128) NOT NULL,
[Email]                NVARCHAR (256) NULL,
[EmailConfirmed]       BIT            NOT NULL,
[PasswordHash]         NVARCHAR (MAX) NULL,
[SecurityStamp]        NVARCHAR (MAX) NULL,
[PhoneNumber]          NVARCHAR (MAX) NULL,
[PhoneNumberConfirmed] BIT            NOT NULL,
[TwoFactorEnabled]     BIT            NOT NULL,
[LockoutEndDateUtc]    DATETIME       NULL,
[LockoutEnabled]       BIT            NOT NULL,
[AccessFailedCount]    INT            NOT NULL,
[UserName]             NVARCHAR (256) NOT NULL,
[RegisterDate ]        DATETIME       DEFAULT (getdate()) NULL,
[ExpiryDate]           DATETIME       DEFAULT (getdate()+(60)) NULL,
CONSTRAINT [PK_dbo.AspNetUsers] PRIMARY KEY CLUSTERED ([Id] ASC)
);

现在,我想在每次用户尝试登录时检查到期日期值。我应该在代码中实现哪些逻辑和什么逻辑?

0 个答案:

没有答案