I created a new MVC5 project with Identity and it makes its own db which i want to change with same one but mine and on cloud server. so i have 2 connection stings and the only things that i changed was table names ex: aspnetUser to CJUser and so on. I want some simple way of changing auto generated local db to my own cloud one.
我创建了一个带有Identity的新MVC5项目,它创建了自己的数据库,我想用同一个但我和云服务器更改。所以我有2个连接蜇,我改变的唯一的东西是表名ex:aspnetUser到CJUser等等。我想要一些简单的方法将自动生成的本地数据库更改为我自己的云数据库。
2 connection strings i have are default one which Identity creates and my own db which i connected.
我拥有的2个连接字符串是Identity创建的默认连接字符串和我连接的自己的数据库。
So project works with its own connection but when i change connections in Identity models to mine, it stops working.
所以项目使用自己的连接,但是当我将身份模型中的连接更改为我的时,它就会停止工作。
public class ApplicationUser : IdentityUser
{
public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager)
{
// Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
// Add custom user claims here
return userIdentity;
}
}
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext()
: base("IdentityDbContext", throwIfV1Schema: false)
{
}
public static ApplicationDbContext Create()
{
return new ApplicationDbContext();
}
}
}
1 个解决方案
#1
Try to use Automatic migration
尝试使用自动迁移