c# - EF6: Renaming namespace using Code First Migrations -
it possible me rename namespace of entire project (including of course: dbcontext class, migrations configuration classes, etc) without breaking or having recreate migrations?
say, have project myproject, namespace is
foo.myproject
and configuration classes in
foo.myproject.migrations
say want rename foo namespace bar, , of course configurations namespace be
bar.myproject.configurations
is there correct way of doing , maintain current migrations still working? these ways involve manually editing ___migrationhistory table or something? (at glance see contextkey column, suspect should manually edit.)
yes, indeed need update contextkey in the__migrationhistory table. code:
update [dbo].[__migrationhistory] set [contextkey] = 'new_namespace.migrations.configuration' [contextkey] = 'old_namespace.migrations.configuration'
a read on topic of renaming namespaces ef6:
Comments
Post a Comment