Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/316.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 将默认的AspNet表更改为我自己的表_C#_Asp.net Mvc 5_Asp.net Membership_Asp.net Identity - Fatal编程技术网

C# 将默认的AspNet表更改为我自己的表

C# 将默认的AspNet表更改为我自己的表,c#,asp.net-mvc-5,asp.net-membership,asp.net-identity,C#,Asp.net Mvc 5,Asp.net Membership,Asp.net Identity,我遇到过这样的情况。我有一个web MVC应用程序,它使用Facebook进行外部身份验证。它工作正常,但我需要更改插入用户的表。例如,有一个名为AspNetUsers的表,我想将其更改为我的Users表。我的IdentityModel中有这个代码 public class ApplicationUser : IdentityUser { public async Task<ClaimsIdentity> GenerateUserIdentit

我遇到过这样的情况。我有一个web MVC应用程序,它使用Facebook进行外部身份验证。它工作正常,但我需要更改插入用户的表。例如,有一个名为AspNetUsers的表,我想将其更改为我的Users表。我的IdentityModel中有这个代码

public class ApplicationUser : IdentityUser
        {
            public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager)
            {
                var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
                return userIdentity;
            }
        }

public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
    {
        public ApplicationDbContext()
            : base("Entities", throwIfV1Schema: false)
        {
        }

        public static ApplicationDbContext Create()
        {
            return new ApplicationDbContext();
        }
}
公共类应用程序用户:IdentityUser
{
公共异步任务GenerateUserIdentityAsync(用户管理器)
{
var userIdentity=wait manager.CreateIdentityAsync(这是DefaultAuthenticationTypes.ApplicationOkie);
返回用户身份;
}
}
公共类ApplicationDbContext:IdentityDbContext
{
公共应用程序上下文()
:base(“实体”,throwifvv1schema:false)
{
}
公共静态应用程序上下文创建()
{
返回新的ApplicationDbContext();
}
}
我看过所有这样的帖子。例如,我尝试添加一个名为OnModelCreating的受保护方法,它是

protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
    base.OnModelCreating(modelBuilder);
    modelBuilder.Entity<ApplicationUser>().ToTable("PPP_Users");
}
模型创建时受保护的覆盖无效(DbModelBuilder modelBuilder)
{
基于模型创建(modelBuilder);
modelBuilder.Entity().ToTable(“PPP_用户”);
}
但它给了我一个错误,说有无效的列

有谁能帮我回答这个问题吗?
事先谢谢。

好的,伙计们。我创建了一个新表,其中包含相同的字段。并更改了AspNetUserLogs表中的一些位。对我来说,它现在运行得很好