سؤال

I'm using Asp.Net Identity 2.0.1.

If i copy a database from one development environment to another i get the following error. When i login to my application ().

The Model backing the 'ApplicationDbContext' context has changed since the database was created.....

This is two seperate machines (machine1 and machine2) and the database connections on both are correct, however on the development environment(machine1) where the identitymodel was first generated there are no problems. But on machine2 i get the above error. (My ApplicationDbInitializer is set to CreateDatabaseIfNotExists rather than DropCreateDatabaseIfModelChanges)

Does Identity use the MAC address when defining the Model? And if so is there a way to workaround this?

هل كانت مفيدة؟

المحلول

After some more investigation I realized my assumptions were incorrect. the versions of the entityframework package differed on the two machines. One was using EntityFramework.6.1.1-alpha1-30211 and the other EntityFramework.6.1.1-alpha1-30429. i spotted this in the _MigrationHistory table, I tried changing the ProductVersion field in the _MigrationHistory table on machine2 to match its version of EntityFramework but this didn't work, so I rolled the referenced version back and it worked.

Strange behaviour however. It implies minor versions or patches of EntityFramework will require rebuilds/changes to codefirst databases?

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top