C# 使用EntityFramework自动迁移。迁移会在重命名时出错,但在SqlMigrations中不会
我正在使用EntityFramework和EntityFramework.Migrations,以实现使用代码优先和自动迁移的解决方案 无论我在哪里做了一个非常简单的测试解决方案来测试迁移功能,我都被卡住了,并重新命名了简单的属性 我有这个实体:C# 使用EntityFramework自动迁移。迁移会在重命名时出错,但在SqlMigrations中不会,c#,entity-framework,ef-code-first,C#,Entity Framework,Ef Code First,我正在使用EntityFramework和EntityFramework.Migrations,以实现使用代码优先和自动迁移的解决方案 无论我在哪里做了一个非常简单的测试解决方案来测试迁移功能,我都被卡住了,并重新命名了简单的属性 我有这个实体: public class Customer { public int Id { get; set; } public string FullName { get; set; } public
public class Customer
{
public int Id { get; set; }
public string FullName { get; set; }
public string LastName { get; set; }
}
现在,当我尝试将FullName重命名为FirstName时,我知道我必须将Update Database与重命名一起使用,因此我在控制台中键入以下内容:
Update-Database -Renames:"Customer.FullName=>Customer.FirstName"
当我使用SqlMigrations时,这项功能正常,但现在我使用EntityFramework.Migrations。它不起作用,它会给我以下错误:
Update-Database : A parameter cannot be found that matches parameter name 'Renames'.
At line:1 char:26
+ Update-Database -Renames: <<<< "Customer.FullName=>Customer.FirstName"
+ CategoryInfo : InvalidArgument: (:) [Update-Database], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,System.Data.Entity.Migrations.UpdateDatabaseComma
nd
所以我打赌在EntityFramework.Migrations中它是不同的,我不确定我做错了什么或者我应该做什么
以下是我一直在阅读的有关这两方面的资料:
EntityFramework.Migration团队已确认此功能已被弃用,并且不在EntityFramework的上次Beta版中。Migrations您可能需要检查另一个EF代码优先迁移库