Skip to main content

Mobile Services from Windows Azure - Introduction

What do you think about Windows 8 and Windows Store? It has a great potential and is a place where people with good ideas can develop application.
Usually when you develop an application you also need a backend. A place where authenticate users, to store data and so on. Windows Azure comes with a solution that can freaks out any kind of backend developer – Mobile Services
Why is so great? A lot of backend stuff that you need in a normal mobile application is built in. Let me give you some example:
  • Authentication infrastructure for Windows Live, FB, Twitter, Google and more coming soon
  • Push notification
  • Store data on the server
  • Custom scripts on working with server data
And this is not all. Imagine that you develop an application for iOS. Could you integrate Mobile Services from Windows Azure? YES, you can. In this moment, after you setup your mobile service you can download a sample application for Windows 8 App, Windows Phone or iOS that contains all the settings for your account and a demo application.
In this way starting using Mobile Services and integrate it in your application is an extremely simple job.  In this moment Mobile Service in the preview state. During this period you can use up to 10 mobile services and have maximum 165MB out band traffic per day for free. More about pricing of Mobile Services can be found in the following link:
What I really liked at this service is how rapidly you can integrate it in your application. In less than 5 minutes you can create a service and connect your mobile application to it.
Let’s see what you need to do for creating a mobile service. If you don’t have a Windows Azure account yet, you should create a new account. After this go to New->Mobile Service->Create. Because this service in in the Preview, you will have to go to and hit the “Try it now” on Mobile Services section.
You will need to give a unique name to your service. Also, a SQL Azure Database needs to be created. If you already have a database created, you can it without any kind of problems. If you have a trial account on Windows Azure it is okay. The trial account also contains a 1GB SQL database.
The last think that I want to tell you is related to how your services are exposed. Of course you have component for WP8, Windows 8 App and iOS that can make all the calls for you, but you should know a little about how the magic happens. Like the rest of services exposed by Windows Azure, REST API is the secret. All the services are exposed using REST API. In this way services are not limited to specific consumers. You can develop application in any languages – and trust me, the REST API is very well documented.
In this blog post we saw what are Mobile Services, what we can do with them. In the next post we will take each feature and present it from a developer perspective (what we need to take an account and how to integrate it).
Part 2


Popular posts from this blog

ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded

Today blog post will be started with the following error when running DB tests on the CI machine:
threw exception: System.InvalidOperationException: The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer' registered in the application config file for the ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application. See for more information. at System.Data.Entity.Infrastructure.DependencyResolution.ProviderServicesFactory.GetInstance(String providerTypeName, String providerInvariantName) This error happened only on the Continuous Integration machine. On the devs machines, everything has fine. The classic problem – on my machine it’s working. The CI has the following configuration:

TeamCity.NET 4.51EF 6.0.2VS2013
It seems that there …

GET call of REST API that contains '/'-slash character in the value of a parameter

Let’s assume that we have the following scenario: I have a public HTTP endpoint and I need to post some content using GET command. One of the parameters contains special characters like “\” and “/”. If the endpoint is an ApiController than you may have problems if you encode the parameter using the http encoder.
using (var httpClient = new HttpClient()) { httpClient.BaseAddress = baseUrl; Task<HttpResponseMessage> response = httpClient.GetAsync(string.Format("api/foo/{0}", "qwert/qwerqwer"))); response.Wait(); response.Result.EnsureSuccessStatusCode(); } One possible solution would be to encode the query parameter using UrlTokenEncode method of HttpServerUtility class and GetBytes method ofUTF8. In this way you would get the array of bytes of the parameter and encode them as a url token.
The following code show to you how you could write the encode and decode methods.

Entity Framework (EF) TransactionScope vs Database.BeginTransaction

In today blog post we will talk a little about a new feature that is available on EF6+ related to Transactions.
Until now, when we had to use transaction we used ‘TransactionScope’. It works great and I would say that is something that is now in our blood.
using (var scope = new TransactionScope(TransactionScopeOption.Required)) { using (SqlConnection conn = new SqlConnection("...")) { conn.Open(); SqlCommand sqlCommand = new SqlCommand(); sqlCommand.Connection = conn; sqlCommand.CommandText = ... sqlCommand.ExecuteNonQuery(); ... } scope.Complete(); } Starting with EF6.0 we have a new way to work with transactions. The new approach is based on Database.BeginTransaction(), Database.Rollback(), Database.Commit(). Yes, no more TransactionScope.
In the followi…