asp.net - MVP - Presenter and the Service Layer - Where to declare Service Layer -


I Microsoft for Enterprise. Reading through Net Solutions and I have a presentation and a few things related to the service layer.

First of all, my presenter needs to call ways in the service layer, such as beginning (), save () and so on. But where do I place a reference to the service layer? Should it be at the class level in the presenter, or should I define a new service in the way of the presenter?

Second - This book is not really clear - how is it processing in such a way that the presenter works for the service layer?:

  Public Zero Process Anticipation ) {// Get data from visual string selectedForPolePosition = predictionPageView.DriverPolePosition; String selected forSecondPosition = predictionPageView.DriverSecondPosition; String selected FORThirdPosition = predictionPageView.DriverThirdPosition; Selected stringforthposition = prediction pageview.whvorfthirthhep; Selected stringfirstpositionposition = predictionPageviewerfifth status; String raceTitle = predictionPageView.RaceTitle; // Prepare to send service layer forecast DTO forecast = new forecast DTO (); Prediction. Rastital = Rational; // More DTO filling here ... // ... // ... IPdiquity service prediction service = new forecast service (); PredictionService.ProcessPrediction (prediction); }    

  ipdiction service forecast service = new forecast service ();   

This will really depend on many factors:

  • The life and time of the presenter of the service
  • If you
  • If service is to be disposed of
  • If any inactive time in service (for example, if it is WCF proxy ) < / Ul>

    In short, this is not an architectural design - it is more than design decision.

    If you use the DI tool, then you:

      IPDecision Services Prediction service = Dantanair. Resolve & lt; Ipdicton service & gt; ();   

    or better , do not mention any of the above and declare it only as property and DI equipment can present it while presenting it.

Comments