Search code examples
c#winformsmvp

MVP Winform Solution/Project file Layout


Can someone help me define a physical file layout for a Winforms MVP multi-project solution?

There are many posts that touch on how to setup the views, interfaces, etc. ... the workings of MVP. I get that. Many posts also say that the physical layout of the project is very subjective and open to personal preference.

Well, I have no preference or experience or history. I am trying to simply build a "Template" solution for a current and for future MVP Winform projects. I am looking for some guidance on laying out the files of the solution, projects, folders, etc.

All of my MVP solutions will include the following:
- The solution itself with a master Winform
- A "modules" folder that contains projects for the various modules (ap, po, ar, inventory, etc.) for the solution
- A "helper" class library project that simply holds some of my methods, routines, etc. for performing common tasks
- A Business Logic class library project that contains all the BL
- A Data Access Logic class library project that handles all the data access routines - mostly using Entity Framework models

The main Winform will call User Controls from the respective Modules so everything is repeatable and portable. Where is the best place to keep the Interfaces, controllers if using Supervisor model or Passive model, etc.?

Current solution file layout


Solution

  • Your solution looks fine. One thing I want to caution you though, having gone down this road, is that it looks like you are going to have composite user controls that are made up of other user controls.

    In WinForms, there is a massive problem with flicker in that scenario and you are going to have to do some tweaking so that the app does not appear sluggish. Check out this question to help you get around the issue.