简体   繁体   English

Windows Phone App本地存储和Azure

[英]Windows Phone App local storage and Azure

Have a few questions regarding the best way to go about building a WP8 app that will link in with cloud storage via Azure. 对于构建可通过Azure与云存储链接的WP8应用程序的最佳方法有一些疑问。

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. 我当前的解决方案使用SQLite,我认为拥有本地数据库以及所有Azure云代码可能会过大。 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); 还是我应该使用SQL Server CE,那样,当我调用App.MobileService.GetTable()。InsertAsync(record);时,我的模型(X)类将与Azure的需求匹配。

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. 另一种选择是将记录保存为JSON字符串形式在手机上,但是我需要自己管理PK,而这些将与Azure使用的PK不匹配。 I'll also need to push the device ID to Azure so I know which devices have pushed which records... 我还需要将设备ID推送到Azure,以便知道哪些设备推送了哪些记录...

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. 我正在乌干达进行我的应用程序的现场测试,一个主要问题是缺乏可靠的互联网连接,我试图将记录推送到Parse(parse.com),但显然他们的“ saveEventually” API尚未针对.NET实现,它一直用记录代码“ OtherError”使应用程序崩溃,那是我可以访问3G / Wi-Fi的时候。 So I figured I'd ditch Parse and go with something a bit more reliable like Azure. 因此,我想放弃了Parse,选择了像Azure这样更可靠的产品。

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. 我不知道是否应该将每条记录保存在应用程序中时将其推送到云中,还是等到有Wi-Fi连接可用时再将它们的负载一次推送到云中。 I could check if there's a Wi-Fi connection each time the app is launched for example. 例如,每次启动应用程序时,我都可以检查是否有Wi-Fi连接。

Is NetworkInterface.GetIsNetworkAvailable() alone sufficient in trying to ascertain if a network connection is available? 仅NetworkInterface.GetIsNetworkAvailable()是否足以确定网络连接是否可用? 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). 我的问题是,在乌干达这样的地方,有时可以使用3G,因此即使用户没有剩余的数据余量(或者类似的事情是您通过无线网络连接到Wi-fi的情况),该应用程序也会认为存在3G连接。酒店,但您只能访问酒店的登录页面,同样,该应用可能会认为存在有效的连接)。 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? 我想在继续保存记录之前检查是否可以打我的Azure URL并查看是否有任何响应?

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). 我敢肯定,还有其他利用某些本地存储以及Azure用于云存储(互联网条件不佳)的应用。

Hy, HY,

I recommend the use of Azure and MobileServices, essential for a mobile application, sql lite still too early to see it now, if you want to keep the data in the local choice to make now for my experience and LinqToSQL and a database. 我建议使用Azure和MobileServices,这对于移动应用程序是必不可少的,如果您希望将数据保留在本地选择中以根据我的经验以及现在的LinqToSQL和数据库使用,sql lite现在还为时过早。 sdf or SqlCompact , great for mobile applications. sdf或SqlCompact,非常适合移动应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM