JohannesH (2) [Avatar] Offline
#1
In listing 2.5 the HomeController takes in a ProductRepository and then creates a new ProductService instance for each call to an action. Is this a common pattern? I mean, why not just let the HomeController take a ProductService and use the same instance throughout the controller? Or to put it another way; doesn't this sort of violate the "single composition root" principle? It just seems odd to me. Sorry if I'm missing something.

Kind regards,
Johannes
mark.seemann (383) [Avatar] Offline
#2
Re: Listing 2.5
JohannesH (2) [Avatar] Offline
#3
Re: Listing 2.5
Thanks Mark