public PostingController(IPostingRepository postingRepository, IChannelRepository channelRepository, ITemplateRepository templateRepository) { this.postingRepository = postingRepository; this.channelRepository = channelRepository; this.templateRepository = templateRepository; }
/* ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// The following section preceded the introduction of Simple Injector IoC. Simple Injector requires a public constructor to exist but can be configured to restrict use of class as a singleton - see global.asax ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // explicit private constructor to prevent other classes creating instances private PostingService(IPostingRepository _repository) { repository = _repository; } public static PostingService Instance { get { // ensures thread safety lock (padlock) { if (instance == null) { instance = new PostingService(new PostingRepository()); // site of injection? } return instance; } } } */ /// <summary> /// public constructor intended to be used with singleton configuration by DI framework /// </summary> /// <param name="_repository"></param> public PostingService(IPostingRepository _repository) { repository = _repository; }