Model-View-Presenter, where does the View interface belong?

Iโ€™ll take another look at the Model-View-Presenter (or the Controlling Controller, whatever he calls these days), because we use WebForms exclusively at work, and I think sharing problems can help.

My question is about the View interface. I understand that you create a presentation for each page with the presenter, and the ASPX page implements the IWhateverPageView interface so that it can go through itself as the viewerโ€™s view is used. Where is this interface created for projects / DLLs? I know that MyProject.Presentation usually have a library of classes MyProject.Presentation in which they live (and then you can have separate libraries for your Repositories / Services / Domain objects / etc.). IWhateverPageView interface belong to the Presentation layer, possibly in a child namespace (e.g. MyProject.Presentation.Views )? Does he need his own library (e.g. MyProject.Views )?

What is the general structure for this?

+4
source share
2 answers

I did a lot of MVP in WebForms, and I usually organized my project very simply to get started.

MyProject.Web.UI

Contains a website. Web pages, javascript, etc.

Myproject.web

It contains all the speakers, presentations (interfaces) and the logic necessary to connect the user interface to the business logic.

Myproject.lib

It usually contains domain logic, but if the project is simple enough, I insert it into the MyProject.Web assembly.

MyProject.Web.Tests, MyProject.Lib.Tests

Do you have test projects?

In the end, it really depends on your needs. There is no standard practice, so any agreement you come up with should make sense for you and your team . If this means that you have one, two or twenty projects, then so be it.

+2
source

I have one specific project with model interfaces, presentations and presentations, so the facilitator can easily use the interface view. This works very well for us. I donโ€™t think you need a contract in a separate layer; the idea is that the presentation interface is a contract so that it can work with the presenter ...

0
source

All Articles