mobile-services-feature-e1409846259154

Azure Mobile Services .NET Backend – Error – The Model Backing…

Error – The model backing the ‘tableServiceContext’ context has changed since the database was created. Consider using Code First Migrations to update the database

I’ve been beating Azure Mobile Services up for a while now. I have to say the product demoed well and the code samples looked pretty straight forward. After digging beyond the basic lit and branching into a project more useful than the ToDoItem demo.

Side bar for a second, I’ve seen a lot of these ToDoItem demos, JavaScript frameworks are using them now and other places, they suck, they never use a traditional Parent/Child data relationship. In my experience this type of relational behavior is always a little different, JavaScript Binding frameworks, LINQtoSQL vs EF, SSRS vs Crystal sub reports. Every system has its own nuances on how it handles relational data. So single tables demos are shit, that’s my opinion.

So, this error basically means there’s a mismatch between the stored data schema and the application data schema. “Ya daterbase don’t match yer application”. You fix this problem by either, “using Code First Migration”, here’s a link on how to implement Code First Migration. This will only take you a week of evenings to figure out. Alternatively, you could do as I did twice and completely delete your Azure Mobile Service instance and associated content, that takes about an hour.

Or you can, from Visual Studio, go to Server Explorer, Go to Data Connections, MS_TableConnectionString (ProjectName), Tables and delete all the tables. Don’t forget to delete __MigrationHistory as well. Next time you F5 your solution it will build all new tables and the error will go away.

About the author