internal static void InitialiseerDI(out IClientManager clientManager, out ICountryManager countryManager, out IInvoiceManager invoiceManager, out IConsultManager consultManager) { IConfigurationBuilder configBuilder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json", optional: true); var config = configBuilder.Build(); var connectionstring = config.GetConnectionString("StandaardverBInding"); //setup our DI var serviceProvider = new ServiceCollection() .AddLogging() .AddScoped <IClientManager, ClientManager>() .AddScoped <ICountryManager, CountryManager>() .AddScoped <IInvoiceManager, InvoiceManager>() .AddScoped <IConsultManager, ConsultManager>() .AddScoped <IClientRepository, ClientRepository>() .AddScoped <ICountryRepository, CountryRepository>() .AddScoped <IInvoiceRepository, InvoiceRepository>() .AddScoped <IConsultRepository, ConsultRepository>() // Onderstaande regel is nodig omdat DI voor de gehele keten moet werken: .AddDbContext <ApplicationDbContext>(options => options.UseSqlServer(connectionstring)) .BuildServiceProvider(); clientManager = serviceProvider.GetService <IClientManager>(); countryManager = serviceProvider.GetService <ICountryManager>(); invoiceManager = serviceProvider.GetService <IInvoiceManager>(); consultManager = serviceProvider.GetService <IConsultManager>(); }
public ConsultController(ILogger <ConsultController> logger, IConsultManager consultManager, IClientManager clientManager, IDoctorManager doctorManager) { _logger = logger; _consultManager = consultManager; _clientManager = clientManager; _doctorManager = doctorManager; }
public FrmClientListView(IClientManager clientManager, ICountryManager countryManager, IInvoiceManager invoiceManager, IConsultManager consultManager) { InitializeComponent(); _clientManager = clientManager; _countryManager = countryManager; _invoiceManager = invoiceManager; _consultManager = consultManager; }