How to consume WCF service in WCSF (MVP) web application?

Topics: Web Client Software Factory, User Forum
Oct 18, 2009 at 3:37 PM

Hi All,

I am new to WCSF and MVP pattern.

I have created a WCSF visual c# web application and I need to consume a WCF service from this web application.

The service has 2 methods for gettting the data from DB and saving the data to DB.

I need to save the controls data and save to the DB using WCF service operation "save" . Similarly I will fetch the data and assign to the controls.

Here is my doubts?

1. Can I add WCF service reference to both View and Presenter? If I do so , am I violating the MVP design pattern?

2. If I add service reference to only presenter then how can I send controls data to presenter and and assign the data to controls by getting the data from presenter.

Here the presenter calls the WCF service operations to save and fetch DB data.

Can u share a simple code example for this scenario.


Srinivas Akella








Oct 19, 2009 at 3:21 PM


In this case it could be an option to develop a foundational module that provides a service and from it call to the WCF service. Depending where you have to have access to the WCF Service methods you may consider to expose this service for a module or globally(all the modules).

That said, about your specific questions:

1. Can you add WCF service reference to both View and Presenter? ...

You can, but it would not be taking advantage of the decoupling the MVP pattern offers, because in this way you would be wiring up the view with the WCF Service and this is not originally idea.

2. In order to answer the second one, you may take a look to the following links about communication between  view and presenter:

Finally here you can find a code example.

I hope you find it helpful.

Fernando Antivero