Invalid Object Name in MVC DB First app - asp.net-mvc

I'm running into a frequent MVC DB first issue where everytime I update my domain model classes from the DB, something always seems to be breaking. In this case, after adding another table and model into my project, running Update model From Database and Generate Model From DB in the .EDMX file, a perfectly good table with a working query is causing the Invalid Object Name error when the app runs in the browser.
I've cleaned and rebuilt my project multiple times. Everything compiles and the error only occurs when the app tries to run in the browser.
Is DB First prone to being buggy or am I not doing something properly when using DB first approach?
Error Screens

Related

Database recreated everytime Application runs

Good day guys,
I noticed my application deletes database structure and re add new one everytime i Run my application.
The DBset uses DropCreateDatabaseIfModelChanges. I have read about the other options like CreateDatabaseIfNotExist. is there any other option to force it from recreating database?
And also with throwing any exception of error?
I have been able to resolve this by using Code First Migrations

Table Updates Made in SQLiteStudio Not Recognized by iOS Mobile Application

I am working on a iOS mobile application using Xcode as the IDE and Swift as the language of choice. I added a column to the SQLite database that interacts with my application but unfortunately when I attempt to perform any database operations through the application the column is not recognized.
The following error is sent:
DB Error: 1 "table xyz has no column named column_name"
When I added the column I also increased the database version or user_version in SQLiteStudio.
Is there something else I should be doing to cause the application to recognize the changes? I know uninstalling and reinstalling would work but that is not an option of course as I cannot lose the data currently housed in the database. My other idea was to put all the data in temporary variables or something like that, drop and recreate the tables and reinsert the data. I wasn't sure if this was a good course of action though. Any help with this is appreciated.

CoreData Issue: There was an error creating or loading the application's saved data

My CoreData Worked before when I had an entity with one attribute called test, I tried to add a new attribute in the data model and I also defined it in my data.swift file but when I launch the application, it crashes on the loading screen every time, what am I not doing right? I can provide my code as needed.
When you run the application and then change the CoreDataModel, the next time you run the application it will give you an error indicating that the data model used has changed. To fix this, you can either remove the old version from the simulator (or device) and run the app again, or you can create a new CoreData version.
If just testing before the app has been released, deleting and running the app again works fine...

MVC3 Entity Connection string disappearing

I am having a very frustrating problem with my current project. It is continually losing the connection string binding for Entity models.
I have multiple models for different databases in separate areas and was having no problems. Suddenly now whenever I try to update from the database I get the connection string setup prompt. I select for it to add it to the Web.config with the password but it doesn't ever pick it up there again. They all are still in the web config but it just doesn't see them.
If I remove all the connection strings from the config file it will write the new one there. Then when I try to set up a Stored procedure/Function Import, I still get the statement in the lower box:
No database connection has been configured for this model.
I have tried rebuilding the project and creating the models again from scratch and that works for a while. When I try and bring the project in under Perforce source control, it winds up getting re-corrupted & the connection string goes away. It affects all of my models too.
I am also using EF 4.x DbContext Generator to create context files. They work fine. I am also able to run the application and it connects to the database just fine and returns data. No issues there. I am just unable to update Entity Complex types from the DB or import any more stored procedures.
An even weirder occurrence was that I opened a broken project from a different directory then opened an uncorrupted copy it instantly became broken also. Contagious!
Any thoughts on where to look into to see why this is happening? Has anyone else had this issue?
I seem to have found where the issue is coming from.
I seem to have a bad value somewhere in my web.config which causes the issue. Here is the work around I found did the trick and showed it's the config:
When the binding breaks, I closed the project then swapped out the web.config with one from a good build which was missing a couple keys but worked well enough to bind.
I reopen the the solution and the "No database connection..." error goes away.
Then while the solution is still open I re-swap the web.config back in and it still works.
This is far from optimal but I can work until I figure out the bad value via doing some compares.
I will comment on this again once I determine the exact issue.

Core Data Migration - Table Already Exists

I have an existing iPad application to which I've just added core data versioning. I've been through the documentation and followed the steps detailed. Now after choosing my new model as the current versioned model and trying to run it on my dev device from xCode I get the following error:
2012-03-28 07:35:42.137 DocsOnTap[2603:707] CoreData: error: (1) I/O error for database at /var/mobile/Applications/06EECF01-3598-4513-8A3A-BE4FD49EEBF6/Documents/.DocsOnTap.sqlite.migrationdestination_41b5a6b5c6e848c462a8480cd24caef3. SQLite error code:1, 'table Z_2TAG already exists'
The only change that I made to my model was to add in a single new entity. I have a table named Tag in my model - that appears to be what the error is referring to.
If I revert my current versioned model back to the previous model version then I can run my app on my dev device from Xcode without error.
I have read that there can be problems trying to use core data migration on dev devices. However I just want to test the process to be sure that when we update our app in the Appstore the migration works as expected for our customers.
In my case the same error appeared due to Renaming ID which was set in the Data Model inspector for the Entity. After I removed the Renaming ID the problem'd gone.
Well this was an obscure error. The entity that I was adding was named AppKeys - this must be the name of an entity used internally by core data or SQL Lite. I went back to scratch and found that I could add and migrate other attributes and entities without any problems. However if I tried once again to add my entity named AppKeys then I got the same error saying that 'table Z_2TAG already exists'. So the resolution to my problem is to choose another entity name. It is a pity that this is not documented somewhere obvious - or that the error was not more helpful. Anyway hopefully this might just help someone else one day.

Resources