我正在关注以下文章和存储库模式。
我一度感到困惑,控制器中定义的可选构造函数。
public StudentController(IStudentRepository studentRepository)
{
this.studentRepository = studentRepository;
}
即使,我删除了 - 代码运行良好。这个构造函数有什么用。当我们在主默认构造函数中分配新的上下文对象时。
我正在关注以下文章和存储库模式。
我一度感到困惑,控制器中定义的可选构造函数。
public StudentController(IStudentRepository studentRepository)
{
this.studentRepository = studentRepository;
}
即使,我删除了 - 代码运行良好。这个构造函数有什么用。当我们在主默认构造函数中分配新的上下文对象时。