LoginSignup
4
6

More than 5 years have passed since last update.

Entity Frameworkでコードファーストをする時の注意点

Posted at

Entity Framework4.1からの新機能、コードファーストは非常に素晴らしいのです。
しかし昨日から何故かテストが通らずに
System.InvalidOperationException: The model backing the 'xxxContext' context has changed since the database was created
という例外が出てハマりまくってました。

解決策は簡単で、Web.configのconnectionStringsのaddタグのname属性を、
コンテキストクラス名の「xxxContext」のContextを抜いた「xxx」の部分と同じにしないといけない制約があるそうです。

name属性を「xxxContext」にしていて丸一日ハマってました・・・。

4
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
6