ASP.NET Identity从AspNetUsers表中删除列 [英] ASP.NET Identity remove column from AspNetUsers table

查看:127
本文介绍了ASP.NET Identity从AspNetUsers表中删除列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用ASP.NET Identity首选代码方法时,我想以自己的方式在AspNetUsers表中生成列.我不需要存储多个具有空值的列.我只需要Id,SecurityStamp和UserName列. 我发现的唯一帖子是在这里: AspNet Identity 2.0电子邮件和用户名重复,但仍然不受欢迎(由于Santosh注释中的错误).

When I use ASP.NET Identity first code approach, I want to generate columns in AspNetUsers table in my own way. I don't need to have stored multiple columns with null values. I just need columns Id, SecurityStamp and UserName. Only post, that I've found is here: AspNet Identity 2.0 Email and UserName duplication , but it is still unsloved (due to error in Santosh comment).

那么有人可以告诉我如何解决这个问题吗?

So can anybody tell my how to solve this?

编辑:是否甚至可以删除其中的某些列/属性?

Is it even possible to delete some of these columns/properties?

谢谢

推荐答案

简短的回答是否",并非没有您自己的实现.或者,您可以等待它们在 codeplex 上打开源asp.net身份.谁知道那要花多长时间?

The short answer is no, not without rolling your own implementation. Or you can wait for them to open source asp.net identity on codeplex. Who knows how long that will take.

默认实现包括所有那些未使用的列(见下文).

The default implementation includes all of those unused columns (see below).

// Summary:
//     Default EntityFramework IUser implementation
//
// Type parameters:
//   TKey:
//
//   TLogin:
//
//   TRole:
//
//   TClaim:
public class IdentityUser<TKey, TLogin, TRole, TClaim> : IUser<TKey>
    where TLogin : Microsoft.AspNet.Identity.EntityFramework.IdentityUserLogin<TKey>
    where TRole : Microsoft.AspNet.Identity.EntityFramework.IdentityUserRole<TKey>
    where TClaim : Microsoft.AspNet.Identity.EntityFramework.IdentityUserClaim<TKey>
{
    // Summary:
    //     Constructor
    public IdentityUser();

    // Summary:
    //     Used to record failures for the purposes of lockout
    public virtual int AccessFailedCount { get; set; }
    //
    // Summary:
    //     Navigation property for user claims
    public virtual ICollection<TClaim> Claims { get; }
    //
    // Summary:
    //     Email
    public virtual string Email { get; set; }
    //
    // Summary:
    //     True if the email is confirmed, default is false
    public virtual bool EmailConfirmed { get; set; }
    //
    // Summary:
    //     User ID (Primary Key)
    public virtual TKey Id { get; set; }
    //
    // Summary:
    //     Is lockout enabled for this user
    public virtual bool LockoutEnabled { get; set; }
    //
    // Summary:
    //     DateTime in UTC when lockout ends, any time in the past is considered not
    //     locked out.
    public virtual DateTime? LockoutEndDateUtc { get; set; }
    //
    // Summary:
    //     Navigation property for user logins
    public virtual ICollection<TLogin> Logins { get; }
    //
    // Summary:
    //     The salted/hashed form of the user password
    public virtual string PasswordHash { get; set; }
    //
    // Summary:
    //     PhoneNumber for the user
    public virtual string PhoneNumber { get; set; }
    //
    // Summary:
    //     True if the phone number is confirmed, default is false
    public virtual bool PhoneNumberConfirmed { get; set; }
    //
    // Summary:
    //     Navigation property for user roles
    public virtual ICollection<TRole> Roles { get; }
    //
    // Summary:
    //     A random value that should change whenever a users credentials have changed
    //     (password changed, login removed)
    public virtual string SecurityStamp { get; set; }
    //
    // Summary:
    //     Is two factor enabled for the user
    public virtual bool TwoFactorEnabled { get; set; }
    //
    // Summary:
    //     User name
    public virtual string UserName { get; set; }
}

这篇关于ASP.NET Identity从AspNetUsers表中删除列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆