コード例 #1
0
 public CommerceControllerFactory(ProductRepository repository)
 {
     if(repository == null)
     {
         throw new ArgumentNullException("repository");
     }
     controllerMap["Home"] = ctx=> new HomeController(repository);
 }
コード例 #2
0
ファイル: HomeController.cs プロジェクト: qszhuan/Learn-DI
 public HomeController(ProductRepository repository)
 {
     if(repository == null)
     {
         throw new ArgumentNullException("repository");
     }
     _repository = repository;
 }
コード例 #3
0
ファイル: ProductService.cs プロジェクト: qszhuan/Learn-DI
 public ProductService(ProductRepository repository)
 {
     _repository = repository;
 }