WCF between WinForms applications - winforms

I have two WinForms applications that need to communicate.
I'm thinking about using WCF to establish communication between those two, but converting one of them WCF service application is not an option.
Is there a way to implement the WCF somehow or should I forget about it?
For example I thought of creating a WCF server (with Push and Pull mechanisms) that both applications could use, but I don't think it's very efficient.
Moreover, consider that the users cannot have administrative privileges, if this helps proposing other solutions.

Main idea is create an WCF service hosted in a Winform or an Console application. Than you should add the WCF service reference to your Winform applications References. Rest is simple. You may query the service in a timer say 500ms. This whole consept may help you. If you want to see an implemented example see the link below:
Have you seen: http://wcfsimplechat.codeplex.com/ . This little WCF Chat sample can help i think.

Related

Dynamic alternative to RIA services?

I'm building a silverlight line of business application in silverlight 4 using RIA services currently and i'm finding RIA services to be more and more of a pain everyday..
A lot of the database interaction in this application doesn't follow the usual CRUD pattern and some of the data just doesn't "fit" with the RIA services style of doing things..
Even more importantly it doesn't fit the way my brain thinks about web services!
(I think that abstraction often gets in the way of the business problem you're trying to solve)
It's got to a point where a scary chunk of the code base is workarounds for the object context and spoofing ID's to create some kind of unique key etc..
I'd also like to swap out entity framework for rob conery's massive (he thinks the same way as me about abstraction, dynamic typing etc..)
Are there any alternatives which work using dynamic typing and JSON?
If not I may have to roll my own!
Have you looked at WCF Data Services?
http://msdn.microsoft.com/en-us/data/bb931106.aspx
You might also find that WCF Web APIs suits you better.
http://codebetter.com/glennblock/2010/11/01/wcf-web-apis-http-your-way/#0_undefined,0_

How to query SQL Server through Silverlight web project?

I passed the hello world phase in the Silverlight world but I found out that ADO.NET is not part of the party. :_(
I'd like to know what is the easiest method to retrieve tables\rows\single value from SQL Server.
(At the moment I have a very small DB, so simplicity is more important than complicated smart solutions that can handle large amount of data.)
I what to be able to send a query like:
SELECT * FROM a JOIN b....
I found this article which I'm learning at the moment, yet I'd like to know if there are other ways to access the DB.
Thanks
Asaf
Other way is to use WCF RIA service.
You can't access a database directly from a Silverlight application.
The only way is to use some service.
Here you can learn how to do that with RIA service.
As suggested above, use WCF. This means setting up a WCF service on the webserve which does all the SQL magic. You may want to look at LINQ2SQL (obsolete) or Enterprise Framework for accessing database in this service. In Silverlight you just connect to the WCF service and it will be like magic, especially if you use LINQ.
Remember that you must access the same server your Silverlight app was downloaded from. If not there are special rules that apply.
For binding the data and interface Silverlight (and WPF) supports the MVVM model. This model really simplifies GUI implementation and makes it very easy to maintain the code.

Several questions with silverlight

I'm new to Silverlight, haven't done any project yet. My company is going to start a project which should be 100% silverlight and ria services. Though I've read a book on sl, without some practical experience, I still have some questions left. Hope I can find help here :)
Here are my questions.
The project we are going to build needs both authentication and authorization. I can use Asp.Net membership provider, but there's a problem. During authentication process (Login), the user should provide username, password and temporary pin code. As far as I know, Membership provider doesn't support authentication with more than 2 params(username and password). Is there any workaround on this problem? Maybe I can create my own MembershipProvider? Will this solve the problem?
We plan to use WCF Duplex services and RIA services in a single silverlight application. We want to use duplex services to let a user know when a transaction status changes. What's your experience with this? Is duplex services reliable or we should go the old way, checking the transaction status in interval?
The application should run inside the browser and outside too. My question is if it's possible to run sl app as OOB when we want to use authentication/authorization + RIA Services + Duplex Services? Should we wait somekind of problem here?
I think that's it for now.
Your help is much appreciated.
Membership Question: No, no workarounds... you will have to write your won membership provider... ive done that... its not that hard... but be caerfull or u might fall in a big maintance problem... as i did...

Options for Async Silverlight-to-WPF communication?

What's the fastest communication model for a Silverlight component communicating with a WPF component? That is, at the very least I'd like to consume an event from a Silverlight component in a WPF component.
I understand you can use WCF to build a bridge
I understand you can use Javascript to bridge from WPF -> Silverlight (and I have that working)
I understand you can use COM to go the other way (Silveright -> WPF)
However I'm looking for a tighter communication model (not using COM) - perhaps like EventAggregator (Silverlight component pubs, WPF component subs)...but I've only seen eventAggregation in WPF or Silverlight but not both at the same time.
Any ideas for creating such an eventAgg / eventBus, without using WCF, without using COM?
Open to any approaches / ideas; might be something I haven't considered.
Thanks.
Interesting challenge - could you provide a little more detail on why you need to do this?
My first question is: Are you envisioning these two apps running on the same machine, at the same time? Both are important.
If the answer is yes (same machine, both running) then you should be able to implement a solution using WCF, with the service self-hosted in the WPF app, the Silverlight client referencing it, and a cross-domain policy setup appropriately.
If the answer is yes, but not at the same time, then you'll need a third party, like a Message Bus, perhaps implemented as a Windows Service. NServiceBus comes to mind.
In any case, WCF really is the best solution for messaging in Silverlight. If you were going Silverlight app-to Silverlight app there is a mechanism for that that doesn't require WCF.
A message bus would give you the Event Aggregator functionality you're thinking of - a player who is always there to accept subscriptions and publications.
Another option (if running at the same time) is to elevate your Silverlight app to full-trust and use Sockets. See this link for more info (he provides an example that may be helpful).

What are the methods of communication between Silverlight and server side?

Background:
I have basically no experience in Silverlight, i was asked to start reading up on the tech and provide some insight for client which may want to rebuild the UI of their .Net Desktop application in silverlight. So my experience is what i have been able to google (which surprisingly is not easy) and the few tutorials i have done.
I am aware Silverlight could use ASMX Web Service , WCF Services or REST to do communications with the server.
Question:
Are there any other official or non-official mothods of communication anyone knows of?
Thank you in advance,
David
Start here:
http://msdn.microsoft.com/en-us/library/dd470099(VS.95).aspx
http://videos.visitmix.com/MIX08/T13
http://videos.visitmix.com/MIX09/T42F
I am somewhat biased having worked on the technology :), but I would urge you to consider WCF.
This method gives you great usability: It literally takes a few minutes to "Add New... Silverlight-enabled WCF Service" to your project and have everything up-and-running. In Silverlight 3, this uses a very performant binary XML protocol under the covers, which can be easily switched to regular text XML for debuging with just a 2-line config change. And it integrates nicely with most authentication models that you would want (see the security section in the doc link above).
Of course, you can roll-your-own communication using HttpWebRequest, WebClient, or even sockets. Using WebClient is probably best if you want to go with REST on the server. Keep in mind that some things that are normally possible in REST (such as using PUT and DELETE HTTP verbs) are not possible in browser plugins such as Flash and Silverlight due to browser restrictions.
Finally, there's .NET RIA Services. It's a bit too heavy-weight for some scenarios and doesn't have some of the WCF features (like binary and duplex), but it's more than just a way to communicate with the server: It gives you a whole perscriptive framework for building SL apps with server-side data, and gives you a lot of nice features like validation, paging, etc. for free.

Resources