Quantcast
Channel: entityframework Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1793

New Post: Data-Modifications during Migration

$
0
0
Hi SeriousM,

It is generally not OK to use DbContext within migrations Up/Down methods because migrations represent your model at a point-in-time whereas your DbContext always represents the latest model. So any migrations that used DbContext could easily become out-of-date and no-longer function correctly (or even compile). Another problem is that we allow you to script migrations using -Script, but any data modifications made "out-of-band" would not be included in a generated script.

The Sql() fluent API is currently the best way to do the data modifications you describe.

Cheers,

Andrew.

Viewing all articles
Browse latest Browse all 1793

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>