// Inject hai dịch vụ qua phương thức khởi tạo //Khởi tạo có Inject Option từ DI Container (chú ý tham số IOptions<TestOptions>) public ProductController(IListProductName lsphone, LaptopName lslaptop, IOptions <TestOptions> options) { Console.WriteLine(this.GetType().Name + " created"); this.lsPhone = lsphone; this.lsLaptop = lslaptop; this.options = options.Value; }
// Inject hai dịch vụ qua phương thức khởi tạo public ProductController(IListProductName lsphone, LaptopName lslaptop) { Console.WriteLine(this.GetType().Name + " created"); this.lsPhone = lsphone; this.lsLaptop = lslaptop; }
// Inject hai dịch vụ qua phương thức khởi tạo //Khởi tạo có Inject Option từ DI Container (chú ý tham số IOptions<TestOptions>) public ProductController(IListProductName lsphone, LaptopName lslaptop, IOptions <TestOptions> options) { this.lsPhone = lsphone; this.lsLaptop = lslaptop; this.options = options.Value; }
public ProductController(IListProductName lsPhone, IListProductName lsLaptop, IOptions <TestOptions> options) { this.lsPhone = lsPhone; this.lsLaptop = lsLaptop; this.lvOption = options; }