This article was posted on New Venture Software. You can ready the post by following this link.Comments (0)
At some point you might need to plug into or configure the OWIN pipeline that is used by Azure Mobile Service. The purpose of this post is to demonstrate 3 ways to achive this. Let’s get started.
The 3 ways that we are going to look at today are:
- Using a custom IOwinAppBuilder
- Using a IOwinAppBuilderExtension
When you are initially building an app or you are simply experimenting you find yourself in a situation where the database schema is updated quite frequently. If you are familiar with Entity Framework Code First you know that you can use DropCreateDatabaseIfModelChanges or DropCreateDatabaseAlways initializers to help you with keeping your schema updated. When you are using Azure Mobile Services those initializers will not work because your mobile service does not have permissions to drop the database. If you try to use DropCreateDatabaseIfModelChanges or DropCreateDatabaseAlways you will get an error similar to this:
“This operation requires a connection to the ‘master’ database. Unable to create a connection to the ‘master’ database because the original database connection has been opened and credentials have been removed from the connection string…”
The latest set of updates to Azure Mobile Services introduced two new initializers (ClearDatabaseSchemaIfModelChanges and ClearDatabaseSchemaAlways) that resolve this issue. As their names suggest, those initializers will only modify the database objects within a particular schema instead of modifying the whole database. More information about the latest update can be found here. Keep in mind that those initializers are suitable for the early stages of app development where you do not have to preserve existing data.
One of the in-house projects that I am working on @ New Venture Software in a fitness app called Elite Interval Training. The purpose of the app is to help you create, organize and execute your interval training workouts with ease. If you are into interval training you should definitely check this app out.