Entity Framework 4.1: Code first error: "the model backing the context has changed since the database was created" -


  1. I create a database through a "code first" application, no database in SQL Server The application is running fine, creates the database and the seed of the data defined in my initialization.

  2. For the first time, I try to add some data to a database running in the database. I get an error:

    The database was created because the support model of 'yyyContext' reference has changed. Either manually delete / update the database, or call the Data.SetInitializer with a database. For example, DropCreateDatabaseIfModelChanges will automatically remove the strategy and recreate the database, and optionally it will seed it with new data.

    No changes should be made since the database and then when the service runs.

    I'm running EF 4.1, and the database does not exist, as opposed to the questions with the same title:

      Database.SetInitializer & lt; YourContext & gt; (tap);   

    There is no solution for me

    Any suggestions regarding what may be wrong are welcome.

    Doh! At the moment, it was discovered that the service was not using the same connection to other apps because the reason is that it should not be in the database because in the first development I did not start the main app as a connection string, A local instance database was provisioned for use.

    Then when I was trying to use the service, he was already trying to use a database, and since then the model has changed.

    I worked the connection string right database and everything from there.

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -