title: Windows Phone App local storage and Azure
body: <p>Have a few questions regarding the best way to go about building a WP8 app that will link in with cloud storage via Azure.</p>
  
  <p>My first problem is that I need to store all records on the phone as there may not always be a usable internet connection. My current solution uses SQLite, I thought it was potentially overkill to have a local db as well as all the Azure cloud code. Or should I be using SQL Server CE and that way my model (X) classes will match with what Azure needs when I'm calling App.MobileService.GetTable().InsertAsync(record);</p>
  
  <p>One other option would be to save the records on the phone as JSON strings but I'll need to manage PKs myself and these won't match up with the PKs that Azure uses. I'll also need to push the device ID to Azure so I know which devices have pushed which records...</p>
  
  <p>I was out field testing my app in Uganda and one main problem was the lack of reliable internet connectivity, I was trying to push records to Parse (parse.com) but apparently their "saveEventually" API hasn't been implemented for .NET, it kept crashing the app with the record code "OtherError" and that was when I had 3G/Wi-Fi access. So I figured I'd ditch Parse and go with something a bit more reliable like Azure.</p>
  
  <p>I don't know whether I should try and push each record to the cloud as they're saved on the app or wait and push a load of them in one go to the cloud when there is a Wi-Fi connection available. I could check if there's a Wi-Fi connection each time the app is launched for example. </p>
  
  <p>Is NetworkInterface.GetIsNetworkAvailable() alone sufficient in trying to ascertain if a network connection is available? My problem is that in places like Uganda, 3G is sometimes available so the app will think there is a 3G connection even if the user doesn't have any data allowance left (or a similar thing is where you connect to Wi-fi in a hotel but you can only access the hotel's login page, again the app would probably think there's a valid connection). I thought checking to see if I could hit my Azure URL and see if there's any response before proceeding with saving the record?</p>
  
  <p>I appreciate that my questions are quite vague but just looking for some general advice on how to go about this. I'm pretty sure there are other apps out there that make use of some kind of local storage as well as Azure for cloud storage (with poor internet conditions).</p>