// private object ex; public PointsOfInterestsController(ILogger <PointsOfInterestsController> logger, LocalMailService mailService) { _logger = logger; _mailService = mailService; // HttpContext.RequestServices.GetService()//Provides access to http contianer }
public PointsOfInterestController(ILogger <PointsOfInterestController> logger, LocalMailService mailService) { _logger = logger; _mailService = mailService; // HttpContext.RequestServices.GetService(); }
public PointOfInterestController(ILogger <PointOfInterestController> logger, LocalMailService mailService, ICityInfoRepository cityInfoRepository) { _logger = logger; _mailService = mailService; _cityInfoRepository = cityInfoRepository; // HttpContext.RequestServices.GetService() }
public PointsOfInterestController(ILogger <PointsOfInterestController> logger, LocalMailService mailService, ICityInfoRepository cityInfoRepository) { // linjecting through constructor, if it's not feasible, it can also be injected as following: //HttpContext.RequestServices.GetService()... _logger = logger; _mailService = mailService; _cityInfoRepository = cityInfoRepository; }
//logger dependency injection public PointsOfInterestController(ILogger <PointsOfInterestController> logger, LocalMailService mailService) { _logger = logger; _mailService = mailService; }
public PointsOfInterestController(ILogger <PointsOfInterestController> logger, LocalMailService mailService) { _logger = logger; //Example of Constructor Injection. The reccomended method of dependency injection _mailService = mailService; //HttpContext.RequestServices.GetService(PointsOfInterestController logger); }