更新时间:2023-01-01 11:36:27
是的,你确实需要更新_MigrationHistory表中的ContextKey。代码:
Yes, you do indeed need to update the ContextKey in the__MigrationHistory table. Code:
UPDATE [dbo].[__MigrationHistory]
SET [ContextKey] = 'New_Namespace.Migrations.Configuration'
WHERE [ContextKey] = 'Old_Namespace.Migrations.Configuration'
使用EF6重命名名称空间的主题:
A good read on the topic of renaming namespaces with EF6:
http://jameschambers.com/2014/02/changing-the-namespace-with-entity-framework-6-0-code-first-databases/ 一>