I'm learning an MVP pattern and have the following issues:
If I have one form(project MainForm), one model(project Model) and one presenter, should I create a new project for my presenter or it's ok to put it in MainForm project?
1)If presenter must be located in separate project, it obviously needs a reference to MainForm for it's constructor, what leads us to the second problem:
When the app starts in program.cs (which is in MainForm) I need to create my presenter:
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Presenter presenter = new Presenter(new MainForm()); //Here it is
Presenter.Run();
}
But, since presenter is in a separate project, I can not use it without a reference. However, there is already a reference from presenter to MainForm so i can't add it.
2)If presenter is located in MainForm project, the program starts fine, but to use functions from Model I have to add a reference from MainForm project to Model project, which, I think, contradicts MVP pattern.
Please, tell me how to design my sulution properly.