Separation of windows and classes of Windows C #

I am looking for a way to develop a C # application. I understand the three-level model, but idk how to apply it in a good C # design.

I looked through some asp.net mvc tutorials, but I am looking for a window-based tutorial.

Is there any book or website to find out how to implement this?

+6
c # winforms
source share
3 answers

I find that traditional MVC is redundant for WinForms. A form is a view, and rarely a separate controller is required. A model is just a class (usually implementing INotifyPropertyChanged). You can use data binding to notify that a model has changed.

An important point is to minimize the code under the buttons. If it generates code, it must either (a) be user-defined or (b) delegate model calls. Any business logic must be in the model or in the classes on which the model depends.

Avoid creating a model of the object of God . It can delegate internally to other classes.

EDIT: You might want to move the related data to a separate object belonging to the model. I would call this model of representation , but I do not want to put words in Fowler's mouth.

EDIT2: Important - the model must have NO KNOWLEDGE presentation and NO UI code (for example, dialog boxes).

+3
source share

the first thing you should know is that design patterns are not the same for everyone, and therefore there is no such thing as a β€œWay to implement a design pattern”.

If you mean only a three-level model, then MVC is a good choice, because it clearly separates each level from another; for developing forms, Windows is looking for textbooks on the Entity Framework (or just LINQ), which becomes your model layer, all forms, by the classes used to represent the data, are your representations and, of course, user controllers are good ... this is your controller.

I recommend you take a look at the DoFactory website, which perfectly covers many design patterns.

I should also point out that you cannot find an implementation in doFactory, this is just a link to a bunch of design patterns. Jic.

+1
source share

Hi, if you are using Win Forms I recommend you switch to the MVP template. There's another MVVM template (which is mainly used for WPF and Silverlight), but I don't know if this applies to Win Forms.

0
source share

All Articles