Confusion implementing MVP in web forms

Viewed 90

Question

In the context of ASP.NET web forms, I have two pages: a form and a list view of some data. Both of those "views" need to have a dropdown that is loaded with data depending on what user is logged in (not all users can see all data in the dropdown). In one case the dropdown is for selecting an element and in the other to filter the list based on that element.

What's the most idiomatic way of architecturing this scenario?

There was an attempt

What I currently have is:

  • IAuthView = interface which provides the session token from the ASP.NET page and allows a presenter to set an User property which defines the logged user
  • AuthPresenter = takes the session token and sets the signed user
  • IFormView : IAuthView= an interface to the user inputs and submit events
  • IListView : IAuthView = an interface to the list of data
  • FormPresenter = the class responsible to load data for the form and read data from the form when the user submits.
  • ListPresenter = the class responsible to load the list of data and reload the data when a filter is applied
  • IHasDropdownXView = this view describes a view that has the dropdown
  • HasDropdownXPresenter = populates the view with the dropdown also fetching from the AuthView instance the signed user
  • FormPage : IFormView, IHasDropdownXView = loads all three presenters for each view interface it implements
  • ListPage : IListView, IHasDropdownXView = loads all three presenters for each view interface it implements

This all seems extremely convoluted and complicated for no reason. Moreover it's not clear to me how the IHasDropdownXView should fetch the signed user or who should be responsible to assemble all presenters required in the final page.

0 Answers
Related