如何将C#Windows mobile 6.5应用程序连接到Postgres数据库? [英] How to connect a C# Windows mobile 6.5 app to a Postgres database?

查看:89
本文介绍了如何将C#Windows mobile 6.5应用程序连接到Postgres数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为Windows Mobile 6.5开发一个应用程序,该应用程序需要从该应用程序网络内的Postgres数据库获取和发送数据。

I'm developing an application for Windows Mobile 6.5 that needs to get and send data from a Postgres database within the network of the app.

我已经在Google上搜索并阅读了此事的每个页面,但找不到解决方法。

I've googled it and read every page on the matter but haven't been able to find a solution.

npgsql驱动程序不适用于此sdk。

The npgsql driver doesn't work on this sdk.

推荐答案

非常类似于Android或iOS,我建议您构建一个中介Web服务,该服务由Internet上的服务器提供,电话与之通话,而不是直接与数据库通话。该Web服务将接受REST + JSON,REST + XML,XML-RPC,SOAP或电话客户端提供的任何首选Web服务协议。它会根据电话的请求进行操作,执行数据库中满足请求所需要的一切,然后通过Web服务协议返回任何结果。

Much like for Android or iOS, I'd recommend that you build an intermediary web service that's provided by a server on the Internet that the phones talk to instead of talking directly to the database. The web service would accept REST+JSON, REST+XML, XML-RPC, SOAP, or whatever your preferred web service procotol is from the phone clients. It'd act on the requests from the phones, doing whatever is needed in the database to satisfy the request, and return any result via the web service protocol.

您的单个电话不需要直接与PostgreSQL的连接-这是一件好事,因为电话网络连接容易产生问题,并且重试/重新建立逻辑很难正确处理。您会与Pg服务器建立许多悬而未决的连接。您可以通过HTTP之类的无状态协议来与Web服务进行通信,然后再执行实际工作,从而大大改善了他们。

This means your individual phones don't need connections direct to PostgreSQL - a good thing, since phone network connections are flakey and the retry/re-establish logic can be hard to get right. You'd land up with lots of dangling connections to the Pg server. You're much better off with a stateless protocol like HTTP to talk to a web service that then does the real work.

选择任何网络服务协议最容易在Windows Phone 6.5上使用,并使用首选的后端服务器实施。就您的情况而言,我想这可能是IIS上的.NET。

Choose whatever web service protocol is easiest to work with on Windows Phone 6.5 and implement it using your preferred back-end server. In your case I imagine that's likely to be .NET on IIS.

根据应用程序的不同,您可能已经拥有网络服务协议。如果您使用的是现代网页版本,则很有可能将JavaScript与REST + JSON一起使用来调用服务器端点,在这种情况下,您仅可以扩展并重新用于电话应用程序。

Depending on the app, you might already have a web service protocol. If you have a modern web page version then it's fairly likely to use JavaScript with REST+JSON to call server endpoints, in which case you may just be able to extend and re-use those for the phone app.

这篇关于如何将C#Windows mobile 6.5应用程序连接到Postgres数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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