Reputation: 9568
According to Uncle Bob's Clean Architecture a use case interactor calls the actual implementation of the presenter (which is injected, following the DIP) to handle the response/display.
How should this be done using C# (ASP.NET Core MVC) ?
Shoud the controller be injected with an C# interfaced usecase which exposes a C# interfaced callback ?
Upvotes: 4
Views: 6093
Reputation: 1427
Some people have been interested in documenting the entity boundary interactor (EBI) as descripted by Uncle Bob. There is a master thesis and a more pragmatically but (at the time of writing this post) unfinished documentation aimed at programmers which you can find here. The idea is also part of the book Object-Oriented Software Engineering A Use Case Driven Approach
(Refered to as Entity Interface Controller) by Ivar Jacobson
which Uncle Bob recommends himself in at least one of his talks and a blog post titled Screaming Architecture.
Uncle bob himself gave a talk where he explains what he thinks is wrong with web development and why he thinks a different model would be better (*):
The web for all its complexity for all its importance; the web is a detail. It is not the essence of our application, it is an IO channel. Why would we structure our applciation around an IO channel?
He also gives advice on how to structure the application later on.
Upvotes: 1
Reputation: 3573
In clean architecture presenter and controller are different classes. As u have already described the presenter should be injected into the Interactor. The presenter concerts the Interactor response into the view model which is then passed to the view.
In asp.net MVC this last step involves the controller again which is not 100% as intended by clean architecture but that's how the framework works. So this tiny compromise to make when chosing asp.net MVC.
For more details on this particular question pls reference to my posts here: https://plainionist.github.io/Implementing-Clean-Architecture-Controller-Presenter/ https://plainionist.github.io/Implementing-Clean-Architecture-AspNet/
Upvotes: 4