6
votes

I have atleast 5 billion ideas for a new App in Windows 8. However, most of them rely on a remote database connection.

Which is currently not possible in Metro apps. But I don't want just a work-around. Or an script that accesses an API which will access the DB and return results. So then I went to the MS forums and found a post somewhere (which I can't seem to find now) stating that I can just use Windows Azure SQL database and can connect to that one from within Windows Metro.

But I don't see any resources or documentation to back that up and I'm completely lost as to what to do.

Most apps these days, to offer any sort of personalized user experience need to communicate with the outside world and it's just impossible to do in Metro apps from what I can see.

Does anybody know if you can connect to a Windows Azure SQL DB from within a Metro style app? Any resources/Docs/Links/Samples you know of?

Thank you!

2

2 Answers

2
votes

Metro apps are optimized for tablets and generally CPU-and-battery constrained devices. Directly connecting to a database and processing the results is expensive in CPU, battery AND bandwidth terms.

What's more, database protocols aren't cachable and were not meant to deal with internet latencies. Your app could waste a lot of time trying and retrying to connect to the database each time the connection quality degraded.

The best option would be to a set of WCF Data Services on top of your database and expose them to your application. It's easy to create a WCF Data Service on top of an Entity Framework model and the OData protocol used by WCF Data Services allows querying your entities using LINQ in an asynchronous manner. More complex processing can be done in the web server.

1
votes

At this point Metro does not have a System.Data so there is no direct connect to the database. You would need to communicate with the database via WCF to a Web Service.

Metro does have a user settings facility but I cannot find it right now. http://msdn.microsoft.com/library/windows/apps/BR208189

The history is that the jumping off point for Metro was Silverlight. Not saying that makes sense just what I have read. It appears Microsoft wants to sandbox Metro for the Metro Store.