コード例 #1
0
 //This constructor is used by unit tests. They pass a test double context
 public ProductController(IWebStoreContext context)
 {
     //Use the context passed to the constructor
     _context = context;
 }
コード例 #2
0
 public GenericRepository(IWebStoreContext context)
 {
     this._context = context;
 }
コード例 #3
0
 //The parameterless version of the constructor is used by the MVC controller factory
 public ProductController()
 {
     //Instantiate an actual Entity Framework context
     _context = new RealWebStoreContext();
 }