Prism for Enterprise application

Topics: Prism v4 - WPF 4
Nov 10, 2011 at 1:47 PM

I want to build WPF client as thin as possible using prism (But not silverlight)

(In other words most of th business logis should be in Server.)

1) My question is will the Prism in the client have all the

Model ,View Model and View?

OR can i have

Model/"view model" in the Server.    If they can be in differnt places (cleint and Server) how are they they connected? 

Is there any example?

 

2) I have Database connected to Entity frame work connected to Business logic via WCF

Database

     |

Entiry Frame Work

     |

Business Logic

    | (WCF)

Client WPF (Prism)

 

Some one please say me and is there any exampele for enterprise level application using

WCF,Prism,WPF,Entity framework,Enterprice lib  I can't find any decent examples.

Regards

Developer
Nov 10, 2011 at 2:44 PM

Hi,

The MVVM pattern is intended to be used on Client side applications. It is useful to separate business logic, presentation logic, and purely visual logic in the client side. Information is generally retrieved from the server side part of the application (which in turn has a data access layer) through a service (which might be a WCF service). This information is generally retrieved in the form of model objects. The role of WCF here is to communicate between the client and the server, and it does so by creating an auto-generated proxy class in the client.

One interesting approach you could follow is to place most business logic in the server. You would, however, have to place your view model in the client application. Presentation logic usually involves transforming the model class and exposing it in a way that is consumable for the view. Therefore, if you wish to keep your client side view model class to a minimum, you could try exposing your model classes in a way that will be consumable for the view. You should take into account, however, that if you modify your models to be easily consumable by a specific type of view, you will be coupling your model to your view in a certain way, so you should try to avoid it whenever possible.

You might find the following material useful to better understand the MVVM pattern and its benefits:

As for your second concern, you might find the following blog post useful, where the subject of using WCF services in Prism is explained:

I hope you find this helpful.

Guido Leandro Maliandi
http://blogs.southworks.net/gmaliandi

Nov 11, 2011 at 12:31 PM
Edited Nov 11, 2011 at 12:33 PM

Hi Guidomaliandi

Thanks for you reply and detail information.

1) So what I understand from you answer is MVVM is purley for Client Side WPF apps
2) "VIEW" and "VIEW MODEL"  have to be in Client Side
3) If I try minimizing client side "View model" that will lead to Client "View" and client/server "model" to be coupled together.

A)
What we are trying to develop is a Huge application with same functionality  in WPF and WEB (MVC 3)                       -Not Silverlight
So the idea is to keep as much as possible  code and logic in Server that will be common to both WPF and WEB . (for easy maintenance and to avoid duplication )

Now the million dollar question
What approach woudld be best for this?

We are very much sure MVC 3 is the best for Web. IS there any additional container for Web like "Prism for WPF" (Correct me if Iam worng)

B)
Which  will go well in bellow list.

(Prism wiht MVVM) for WPF and (MVC 3) for web
(Prism wiht MVP)  for WPF and (MVC 3) for web
WPF with MVVM/MVP without Prism  and (MVC 3) for web
Or differnect approch

 

Bearing in mind

1) we are developing huge application same functionality in  WPF and WEB (MVC 3)  

2) Code duplication should be avoided

3) good for Testing

4) easy for maintanence

5) good  future enancements and integaration

6) we don't mind if its the hard and painful way of doing it. but ti should be the best way.

 

Regards

 

Nathan

 

 

 

 

 

 

 

 

Developer
Nov 11, 2011 at 6:09 PM

Hi Nathan,

Prism is a set of guidance provided to develop loosely-coupled client-side applications in WPF or Silverlight. Currently, there is no official support to develop applications in Prism with APS.NET MVC 3.

If you wish to implement a WPF Prism application as a web application, you might find useful to deploy your WPF application as a WPF XAML Browser Application. However, have in mind that this approach is lees widely used with the apparition of Silverlight and there is no official support for it in the Prism guidance.

Regarding the approaches you listed above, the MVVM pattern (which is the one suggested in the Prism guidance) is a specialization of the MVP pattern adapted to take advantage of the capabilities provided by the .NET framework, such as data bindings and commands, so you shouldn't find much differences when implementing MVVM or MVP.

Also, if you wish to implement a web application using ASP.NET MVC 3 following p&p guidance to keep it maintainable, testable, and so forth, you might find the Silk project useful:

I hope you find this useful,

Damian Cherubini
http://blogs.southworks.net/dcherubini