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.
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.
- 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.
- 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).
- 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.
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:
Azure Mobile Services is another great option to store data in remote database.