views:

2290

answers:

12

Does anybody know a useable MVC/MVP framework for enterprise WinForms applications?

Before there was User Interface Process Application Block for .NET. But it is not longer under development since Windows Workflow Foundation has been released (which also will be completely rewritten with .NET 4.0).

Maybe i am not up-to-date, but i seems to me like there is a gap at the moment.

+5  A: 

Have you tried MVC#? I started using it a while back, but the project fell by the wayside, so I can't vouch for it to much - sorry!

EDIT: I just found this article which looks pretty good too.

Kieron
A: 

Smart Client Software Factory?

Bertvan
A: 

I've always rolled my own - it's not really difficult and the more I am in 'control' of my codebase the better I feel.

I just wonder how an MVC framework would fit in with, say, CastleWindsor or the like?

This probably isn't the most helpful of answers but just wondering if you have already considered this option!

Duncan
+3  A: 

We use the Smart Client Software Factory from MS. It provides IDE integration, full MVC support and once you get over the concepts behind it is a very competent implementation. You can acquire it from: http://msdn.microsoft.com/en-us/library/aa480482.aspx

Wolfwyrd
A: 

I didn't like Prism, CAB or SmartClient for being too complex and ended up rolling out my own implementations, in the end.

As time goes, some common patterns are emerging. These are get reused from an application to an application. Here is an example: DDD and Rule driven UI Validation in Windows.Forms with MVC.

Rinat Abdullin
A: 

I'm plugging my own framework : TrueView for .NET. It's based on DDD and the Naked Objects pattern.

At the very least, using it to create quick prototypes is a great way to get decent feedback from your business users.

A: 

All these standard frameworks are not suitable for large complex application developments and they assume that the displays will be static. I have developed my own as well due to the common requirement that the screen controls have to be dynamic, even the MVC/MVP patterns assume that the display will be static so when the fields diplayed in a control depend on what role a user has the MVC/MVP patterns are not suitable. I have developed a tool where you can build the screens from loading up the business objects and their properties into a database then the user just selects the objects and object properties she wants to display, a control can be made up of any number of control groups, each control group can contain any business object property, the business objects are generated from views by my Linq ORM. A control will therefore only display the fields of the control groups that a user has access to. You could also use Aspect orientated programming to provide the gule for the MVC pattern but when the displays have to be dynamic based on the role this overhead would probably add a little to much complexity and performance cost.

I don't see how the MVC/MVP pattern in any way prevents you from doing anything you mentioned.
Dylan Smith
+1  A: 

I am saying that the MVC/MVP patterns require that the required interfaces that the view must implement be known in advance, thus the actual view implements the view interfaces. Hence they are static i.e the interfaces have to be known in advance. It may be possible to make these interfaces as generic as possible but I suspect that some assumptions would need to be made. If the interfaces are made generic then this rather defeats their purpose of having an interface in the first place. By using the MVC/MVP patterns you are trying to reduce the complexity and allow seperation of concerns of the interactions between view logic and model logic and hence making them generic (if it can be done) does not make sense. In general having interfaces is nice if a system is really seperate from another system, however when the components of the system are so close together, i.e they are an intimate part of one system i.e in this case the UI component, then this extra partitioning of the system comes at a cost of flexibility. Can you explain why you disagree with me?

A: 

Hi guys,

very interesting answers. And I partially agree with alicat and I am wondering if alicat could hand out his framework to others. Because this excatly is the problem. If you end up writing your own implementation of common patterns you always have to keep it up to date in terms of documentation, samples and current technology. And for a company which isnt a techology provider this would create unpredictable costs and witout talking about missing skills to create and maintain such frameworks.

So even if the mainstream framework implementation coming from Microsoft or the Open Source aren't complete or are missing flexibility, it would be better then to extend those frameworks with ideas mentionned here rather than creating useless competition and wasting time by reimplementing the basics over and over again...

But I am still wondering if alicat could send me a version of his framework. I would take time to analyse it.

Thanks guys Happy Sunday Michael

A: 

As well as TrueView, there's also Naked Objects for .NET. This supports client/server mode and a web viewer (based on a Java equivalent viewer) is currently being ported.

As for which properties/actions are available for a given user/role, this is done dynamically in Naked Objects. There are three sorts of business rules preconditions that are supported: 1. is the member visible? 2. is the member usable? 3. is the change to the member (new property value or action parameter) valid? Or, more pithily: can you see it? can you use it? can you do it? The Naked Objects programming model lets these rules be specified both declaratively and imperatively.

Even if you end up wrapping your domain model in your own UI layer, I recommend you take a look at NO.

Cheers

Dan Haywood

author: "Domain Driven Design using Naked Objects", pragprog.com

Dan Haywood
A: 

I've used with success the following open source project to implement the MVP pattern in ASP.NET + WinForms + C#:

  • Castle Project.

Take a look at my blog post which shows a complete ASP.NET Web Application sample:

Model View Presenter pattern with Castle in ASP.NET

Leniel Macaferi