How to structure a project in Winforms using the MVP template?

I am going to create an application with Winform, and I would like to use the MVP template.

Since I have never used an MVP template before, I'm not sure how to structure a new project.

Should I use the same convention as in ASP.NET MVC, for example, create in separate project folders for models, presenters and presentations, and then maybe use the naming convention for Presenter classes so that their name ends with the word "Presenter" (in the same way, controller names in MVC end with "Controller")

Or do I need to create separate projects for Presenter and Model?

+6
source share
1 answer

Honestly, this is a very subjective question. The way I do it today may not be the way I do it for the next application. It just works well for me. Also, what works for me may not be the way anyone else would have done it — not that mine is wrong, better or worse.

Naming conventions will help:

  • PersonPresenter
  • PersonViewModel (if data is being read / written to the data store)
  • Personview
  • Ipersonview

In addition, I divided my current solution into 3 projects:

  • The application itself is the only class in this project - Program.cs
  • Presentation models: presenter, viewing interface, viewing model (if applicable); everything in folders organized by their respective views
  • Views: view-only project

Now, the only part of the solution I need to reference unit testing is the PresentationModels project.

+2
source

Source: https://habr.com/ru/post/914157/


All Articles