简体   繁体   English

Windows 8中的Windows Azure和Metro风格的应用程序

[英]Windows Azure and Metro-style apps in Windows 8

I have atleast 5 billion ideas for a new App in Windows 8. However, most of them rely on a remote database connection. 对于Windows 8中的新应用程序,我至少有50亿个想法。但是,大多数都依赖于远程数据库连接。

Which is currently not possible in Metro apps. 目前Metro应用程序无法实现这一目标。 But I don't want just a work-around. 但我不想只是一个解决方案。 Or an script that accesses an API which will access the DB and return results. 或者访问API的脚本,该API将访问数据库并返回结果。 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. 然后我去了MS论坛并在某个地方发现了一个帖子(我现在似乎无法找到)说明我可以使用Windows Azure SQL数据库,并可以从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. 如今,大多数应用程序需要提供任何类型的个性化用户体验,需要与外部世界进行通信,而我从可以看到的Metro应用程序中无法做到这一点。

Does anybody know if you can connect to a Windows Azure SQL DB from within a Metro style app? 有人知道您是否可以从Metro风格的应用程序中连接到Windows Azure SQL DB? Any resources/Docs/Links/Samples you know of? 您知道的任何资源/文档/链接/样本?

Thank you! 谢谢!

Metro apps are optimized for tablets and generally CPU-and-battery constrained devices. Metro应用程序针对平板电脑以及通常受CPU和电池限制的设备进行了优化。 Directly connecting to a database and processing the results is expensive in CPU, battery AND bandwidth terms. 直接连接到数据库并处理结果在CPU,电池和带宽方面是昂贵的。

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. 最好的选择是在数据库之上的一组WCF数据服务 ,并将它们公开给您的应用程序。 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. 在Entity Framework模型之上创建WCF数据服务很容易,WCF数据服务使用的OData协议允许以异步方式使用LINQ查询实体。 More complex processing can be done in the web server. 可以在Web服务器中完成更复杂的处理。

At this point Metro does not have a System.Data so there is no direct connect to the database. 此时Metro没有System.Data,因此没有直接连接到数据库。 You would need to communicate with the database via WCF to a Web Service. 您需要通过WCF与数据库通信到Web服务。

Metro does have a user settings facility but I cannot find it right now. Metro确实有用户设置功能,但我现在找不到它。 http://msdn.microsoft.com/library/windows/apps/BR208189 http://msdn.microsoft.com/library/windows/apps/BR208189

The history is that the jumping off point for Metro was Silverlight. 历史是Metro的起点是Silverlight。 Not saying that makes sense just what I have read. 不是说这只是我读过的内容。 It appears Microsoft wants to sandbox Metro for the Metro Store. 看来微软希望为Metro Store沙盒化Metro。

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

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