0

I have a specific scenario that I can't find answered anywhere.

I would like to use Entity Framework code first backed by VistaDB.

The data that is stored is user specific settings etc so there will be many copies of database but they are never shared across users. But they are stored in local storage, independent of application version.

I can set up the initial model fine, and forward migrations are fine (although I don't yet understand fully how to do this on each users desktop at runtime).

Quite often we will release the application to a few users but then roll back to the previous version if there are issues.

If users run Version 2.0 of app with updated model and they auto migrate their settings DB forward so far so good.

But now we roll them back to Version 1.0. My understanding is 1.0 code can no longer access the database as the model is rolled forward. So what is the solution?

I could create a new settings database each time we update the model, but then how would data get migrated across from the old one? Also this would mean changes to settings made in new version would be lost when rolling back and vice versa.

What I really want is for model changes to be ignored by previous versions (assuming schema compatiblity) just like in XML. i.e. if you add a new column (or XML element) the old code ignores it as it can't see it. But it still works. Perhaps I just need raw database access and not EF for this use case?

Gus Paul
  • 945
  • 2
  • 9
  • 17

1 Answers1

0

i'm not sure if this works the same for VistaDB but to role back the database using EF see this stack overflow question EF Migrations: Rollback last applied migration?

or if the link breaks Update-Database -TargetMigration:"Name of the migration you want to rollback to"

Community
  • 1
  • 1
Casey Sebben
  • 677
  • 6
  • 14