如何在 Windows 应用商店应用程序中与 SQL 交互 [英] How do I interact with SQL in a Windows Store App

查看:46
本文介绍了如何在 Windows 应用商店应用程序中与 SQL 交互的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我被要求开始开发我们公司的 LOB Web 应用程序的 Windows 应用商店版本.与外部数据存储交互的最佳方式是什么?

I've been asked to begin developing a Windows Store version of our company's LOB web application. What's the best way to go about interacting with out data store?

我的第一个倾向是走 HTML/JavaScript(JQuery) 路线并使用 Web 服务来检索数据,但我想尝试使用 C#/XAML,因为我熟悉 XAML,这将是深入了解 XAML 的绝佳机会.

My first inclination is to go the HTML/JavaScript(JQuery) route and use a web service to retrieve the data, but I'd like to attempt to use C#/XAML as I'm familiarizing myself with XAML and this would be the perfect opportunity to take a deep dive into XAML.

Javascript 是与 sql 服务器进行通信的唯一方法,还是我可以通过 C#/XAML 来实现?如果是这样,谁能指出我正确的方向,或者提供一个如何在 WINRT 框架和 SQL 之间连接点"的一般示例?

Is Javascript the only way to communicate with out sql servers, or can I achieve this through C#/XAML? If so can anyone point me in the right direction or perhaps provide a general example of how to "connect the dots" between the WINRT framework and SQL?

推荐答案

您可以使用 C# 或 JavaScript 来完成它,并且您可以通过服务以几乎相同的方式完成它.Windows Store (C#/VB) 应用程序没有桌面应用程序通过 ODBC、JDBC、SQL Native Client 等接口访问数据库的相同功能,因此您不会将 Win RT 应用程序与 SQL 连接,您将通过本身直接访问数据库的托管服务连接它.

You can accomplish it with C# or JavaScript and you'd do it pretty much the same way, via services. Windows Store (C#/VB) applications don't have the same capabilities as desktop apps do to access databases via interfaces like ODBC, JDBC, SQL Native Client, etc., so you won't be connecting your Win RT app with SQL, you'll be connecting it via a hosted service that itself directly accesses the database.

根据您的 LOB Web 应用程序的分区方式,您可以将现有功能公开为服务层,然后通过 HTTP 请求从您的 Windows 应用商店应用程序调用这些服务.HttpClient 示例 应该有所帮助,并且取决于您也可以使用的服务实现Windows 应用商店应用中的 WCF 客户端功能.

Depending on how your LOB web application is partitioned, you may be able to expose existing functionality as a service layer and then invoke those services from your Windows Store app via HTTP requests. The HttpClient sample should help and depending on the service implementation you can also use WCF client capabilities in Windows Store apps.

这篇关于如何在 Windows 应用商店应用程序中与 SQL 交互的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆