Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.8k views
in Technique[技术] by (71.8m points)

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

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 read every page on the matter but haven't been able to find a solution.

The npgsql driver doesn't work on this sdk.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...