3

I have a application which requires me to save data to a database not located on the users computer. Which approach is the best to save and access data for this scenario? Normally I would use Entity Framework and MS Sql Server but this seems not to a options for me with windows store apps.

  • Not sure why you were down-voted without any sort of explanation, but I am also curious about this and would love to see some official answers – Ampt Jun 7 '13 at 19:44
  • 3
    Sharing your research helps everyone. Tell us what you've tried and why it didn’t meet your needs. This demonstrates that you’ve taken the time to try to help yourself, it saves us from reiterating obvious answers, and most of all it helps you get a more specific and relevant answer. Also see How to Ask – gnat Jun 7 '13 at 19:47
  • I don't think he's trying to learn how he stores data. I think he's looking for the best practise scenario and wants to know what the pros and cons of the different methods are. My answer has covered one concern - security. – Mathias Lykkegaard Lorenzen Jun 10 '13 at 15:26
2

I think using some kind of web-API proxy would be your best guess if you are concerned about the security of the app.

It has been proven that Windows 8 apps can be decompiled easily when they are not obfuscated (just like any other Java or .NET based program without obfuscation), and even with obfuscation, one could argue that an eventual hacker would be able to find your connection string anyway.

You can have a server-side web-application language such as PHP, ASP .NET or ASP .NET MVC handle the input from your app, and then make that web application post its data further to the SQL server.

For reading data, the app could pass some ID along with the request in the URL, and the web application could then fetch the information needed from the SQL server, and write the data in the response for your app to read.

This could all work just like a RESTful API, or something similar.

Here's a short example.

  1. The app requests the URI http://www.example.com/api/get-customer?id=38, assuming that you own the domain example.com, and that this is where you host your server-side web-application.
  2. The website internally connects to the database, fetches all information regarding the customer with ID 38, and writes it to the HTTP response through a deserializable format (JSON or XML would do).
  3. The app gets the response, parses it, and uses it visually in the GUI.

This is for fetching data though, but I am sure it demonstrates the concept. You can use it to insert data as well, and so forth.

I realize that a solution like this requires a server or some form of hosting, but at least it helps you move on.

2

You can store data directly to SQLite (local database) after obtaining SQLite WinRT wrapper. Limits on SQLite databases go as high as 140TB.

Store apps don't support ODBC, JDBC, ADO.Net and SQL Native client, etc. So we cannot access the remote database directly in store app. However, we can connect to the database via hosted service that itseld directly accesses database. Hosted service can be:

  • OData
  • REST
  • SOAP

Azure Mobile Services is another great option to store data in remote database.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.