How to connect a C# Windows mobile 6.5 app to a Postgres database?

前端 未结 1 1074
后悔当初
后悔当初 2020-12-22 02:44

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.

I\'ve googled it and

相关标签:
1条回答
  • 2020-12-22 03:26

    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.

    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.

    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.

    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.

    0 讨论(0)
提交回复
热议问题