Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy is my data model and SQL generated by EF different on my web server?
    text
    copied!<p>This issue is so strange to me I don't even know how to explain it. Let me start by saying everything is working fine locally. The problem started when I published my app to a web server. At first I was getting "The model backing the 'DataContext' context has changed since the database was created. Consider using Code First Migrations to update the database". Strange because I didn't make any changes in my data model. First thing I did was deleted the database then ran update-database to create it again using code first migrations. Tested locally worked fine then published (deleting everything) and got the same error. I then set the initializer to null and removed the <code>IncludeMetadataConvention</code>. Deleted db, update-database, publish. Now I am getting an error "Invalid column name 'Item_ID'". Ok that makes sense because I have no column 'Item_ID' in my database. Running SQLProfile I can see that the sql generated locally is not including the column but when run on the server it does. After hours screwing around looking for incorrect connection strings or any other little thing I may have missed, I decided to just copy my entire local folder manually to the web server. Still same error. I no longer know where to look and would like any ideas or suggestions. Let me know if I can provide any code that may help.</p> <p>I recently found that if I use <code>CreateDatabaseIfNotExists&lt;DataContext&gt;()</code> and let the db get created on the server it will work from the server but not locally.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload