How to structure an application that combines WCF and WPF
Posted
by
CiaranG
on Programmers
See other posts from Programmers
or by CiaranG
Published on 2012-10-21T20:20:49Z
Indexed on
2012/10/21
23:18 UTC
Read the original article
Hit count: 418
I'm in the process of learning how to use WCF (Windows Communication Foundation) to allow a client/server desktop application to communicate. The application's UI will be implemented using WPF, and we will probably use SQL Server for our database.
What I'm struggling with, is understanding how to structure such an application.
From what I've read, there are three components of a WCF application (which in the examples I've seen have existed as separate projects):
- A WCF service
- A WCF service host
- A WCF service client
My question then, is - should these projects solely implement the functionality of sending/receiving data from the client/server? Would it make better sense this way?
Would it make sense to create a separate WPF (Windows Presentation Foundation) project to implement the UI for the application?
And so, when I need to send/receive data from the client/server, I could simply invoke the operations provided in the WCF projects that I have created?
For anyone who has built similar applications previously, perhaps you could explain what worked best for you in terms of structuring your application?
For example, if I create a user registration page. When the user clicks the 'Register' button, the client application will need to send the data to the server. In this case, could I just invoke the methods provided in the WCF projects to send the data?
Also, what data structures worked best for you when sending/receiving data? My initial thought is sending/receiving XML containing the data. Is this an option that is easy to implement?
I realise that answers to this question may well be a matter of opinion - unless there are specific best practices that I'm not aware of.
Thank you
© Programmers or respective owner