I'm reading through Architecting Microsoft .Net Solutions for the Enterprise and I try to figure a couple of things out concerning the Presenter and the Service Layer.
First off, my Presenter needs to call methods that reside in the Service Layer, like initialize(), save() etc. But where do I place a reference to the service layer? Should it be at class level in the Presenter, or should I define a new service in the presenter methods itself?
Second - this isn't really clear in the book either - is this how the processing from the Presenter to the Service Layer works?:
public void ProcessPrediction()
{
//Get the data from the View
string selectedForPolePosition = predictionPageView.DriverPolePosition;
string selectedForSecondPosition = predictionPageView.DriverSecondPosition;
string selectedForThirdPosition = predictionPageView.DriverThirdPosition;
string selectedForFourthPosition = predictionPageView.DriverFourthPosition;
string selectedForFifthPosition = predictionPageView.DriverFifthPosition;
string raceTitle = predictionPageView.RaceTitle;
//Prepare for sending to the Service Layer
PredictionDTO prediction = new PredictionDTO();
prediction.RaceTitle = raceTitle;
//More Filling of the DTO here....
//...
//...
IPredictionService predictionService = new PredictionService();
predictionService.ProcessPrediction(prediction);
}