How to access PostgreSQL with Silverlight - silverlight

I create hangman game with silverlight ironpython and I use data in postgresql for random word but I don't know to access data in postgresql in silverlight.
how can or should it be done?
Thanks!!

From Silverlight you cannot access a database directly (remember it's a web technology that actually runs locally on the client and the client cannot access your database directly over the internet).
To communicate with the server from Silverlight, you must create a separated WebService either with SOAP, WCF or RIA Services for example.
That Webservice will expose your data on the web. Call the WebService method to get your data from your Silverlight program.
This WebService layer will be your middle tiers that actually makes the bridge between your postgresql database and your Silverlight application.

Related

How to get the data from mysql database without using webservices like WCFin silverlight application

Is there any other ways so i can get the data from mysql database to show in a datagridview in a Silverlight application without using Webservice like WCF webservice .?
Silverlight is a client side web technology and as such cannot access a database directly. Web services are normally the best way to access the data you want but I guess you could get creative using an elevated trust application and reading from the file system in some kind of hacky way but that's not going to be a good idea!

WPF Client on Windows + WebService on a Linux server

Currently I am developing a WPF application which will handle alot on the client (non business logic that is).
Some data (the business logic) will be coming from a SQL database. To expose this data to the client I was thinking to create a WebService. Normally I would use a WCF Service (or Web Api) to fix this. But in this scenario, there is only a linux server available using a MySQL database, on this server I am unable to host a WCF Service.
I was wondering how I could implement the following:
Users opening the WPF client need to authenticate to the MySQL database.
Users logged in should retrieve some of their personal data coming from the MySQL database.
Which kind of Webservice or technology is the best to go for?
Thanks
You can build a web service in any language, so it comes down to which ones you're comfortable with, or which offer the best tools. If you or your team are already heavily invested in the Microsoft stack, you could try something like Monodevelop: http://monodevelop.com/

WCF client hosted in a windows service with a WPF UI

I have now a WCF service that is hosted inside a WPF application. It's running in a WCF server-client scenario where the client can call the server as well (duplex communications).
I would like to host the WCF client in a windows service, but I'd like to keep the WPF UI because of the functionality it provides when making calls back to the server (e.g. request information). I know that windows services don't have UI, but in this case I need it.
What best way is there to communicate between the WPF application and the windows service? (something better than sockets maybe?)
A scenario where this is useful would be something like:
from the WPF application I can choose what kind of information would be required from the WCF service acting as server,
this "command" would be sent to the windows service hosting the WCF client instance, and
using the the instance making the call to the server and
displaying the information in the WPF application via the WCF client service hosted by the windows service.
Thanks,
Adrian
Since the service is already running as WCF, how about exposing some extra "admin" methods on the WCF interface and have the WPF application interact with the service through those?
You'd have to put in a security layer to make sure only the legitimate user could call those new methods, but this solution might be the least work since the WCF infrastructure is already in place.

Send simple data from wp7 to winforms application

I want to send simple data (geolocation data to be precise) from Windows Phone 7 application to a windows forms application and use it, as I'm a total beginner in this field I don't know which tools to use.
I searched about wcf services and tested this method but there's some issues: the data is sent from the phone application but isn't sent to the winforms application (guess something is missing)
If your know how to do this in a quick way, or have good tutorials I'll be thankful.
EDIT
I found this tutorial, it show how to connect directly wp7 application and desktop application without using sockets neither wcf service, I'm wondering if it is really works if the application isn't in localhost.
the like for the tutorial: wp7 tutorial
I had a similar problem and so I created a REST/JSON WCF service hosted in IIS with AppHarbor to provide the data. There's hundreds of ways to do it (Ruby/Heroku, etc..), but that particular one fits well within the Microsoft stack. I also needed to share route data and I used the WCF service to wrap the BingMaps services so that route computations are cached and shared. Considering that I had already created a local model, moving it out of my phone project into a service took less than a few hours (including the usual config hiccups, and forgetting to add the appharbor user to my bitbucket repo).
Consuming the service from WinForms (or any client) shouldn't be an issue as the service knows nothing about the client implementation.
Here's a tutorial from code project. REST WCF Service with JSON
I think you would need to implement some sort of server side solution which you could upload to on your Windows Phone and download from on your Windows Form application. This could be achieved using a WCF service which was connected to a server side database.
Another option would be to use sockets and communicate directly with your WinForms application. Check this tutorial on how to use basic sockets on WP7.

Can I Access an ADO .Net Data Service from Silverlight across domain with a proper crossdomain.xml file w/out relying on ADO .Net Silverlight Client?

If I create an ADO .Net Data Service, can I access it from Silverlight across domains as long as I don't use the ADO .Net Silverlight Client helpers and I have a proper crossdomain.xml file in place? (I would essentially just get the raw xml and parse it myself)
Asked another way, is it the ADO .Net Data Services Silverlight Client components that don't allow crossdomain calls, or is it the ADO .Net Data Service itself?
I assume it's the client components but would like some confirmation.
I wrote about using a Server-side proxy to make the Silverlight Client library with DataServices hosted on a different domain .
http://blogs.msdn.com/phaniraj/archive/2008/10/21/accessing-cross-domain-ado-net-data-services-from-the-silverlight-client-library.aspx
After further investigation, I found it is as I suspected, the ADO .Net Data Services Silverlight Client limits the communication to calls that are from the same domain. (Not ADO .Net Data Services itself)
This apparently is going to be fixed in a future version of Silverlight.

Resources