samedi 11 juin 2016

Design pattern to consume WebAPI from MVP Winform Client

Background

I'm building a two-tiered application:

  • Tier 1: Winforms application using the MVP (Model-View-Presenter) design pattern.
  • Tier 2: WebAPI RESTful service.

The Winforms client will consume the WebAPI service using HTTPClient. Both tiers heavily make use of IoC and Dependency Injection design patterns

Question

When the Winforms application needs data from the WebAPI service, the presenter will be coordinating the request. My question is, would you use the HTTPClient directly inside of the presenter? In the interest of keeping the presenter testable, how do you make sure that you don't have to rely on a concrete HTTPClient call? I was thinking of somehow integrating also integrating the top answer from this question.

Aucun commentaire:

Enregistrer un commentaire