public LinkService( IShortenerService shortenerService, ILinkRepository linkRepository) { _shortenerService = shortenerService; _linkRepository = linkRepository; }
static void ConfigureServices() { ConfigurationBuilder configBuilder = new ConfigurationBuilder(); configBuilder .SetBasePath(Environment.GetEnvironmentVariable("LOCALAPPDATA")) .AddJsonFile("appsettings.json", optional: false, reloadOnChange: false); configurationService = configBuilder.Build(); serviceCollection = new ServiceCollection(); serviceCollection.AddSingleton(serviceProvider => { return(configurationService); }); serviceCollection.AddSingleton <IRecognizerService, AWSTExtractService>(serviceProvider => { return(new AWSTExtractService(configurationService.GetSection("OCRService"))); }); serviceCollection.AddSingleton <IShortenerService, TinyUrlService>(serviceProvider => { return(new TinyUrlService(configurationService.GetSection("ShortenerService"))); }); serviceCollection.AddSingleton <IStorageService, AzureBlobStorageService>(serviceProvider => { return(new AzureBlobStorageService(configurationService.GetSection("StorageService"), _hunterId)); }); serviceProvider = serviceCollection.BuildServiceProvider(); configurationService = serviceProvider.GetService <IConfiguration>(); shortenerService = serviceProvider.GetService <IShortenerService>(); recognizerService = serviceProvider.GetService <IRecognizerService>(); storageService = serviceProvider.GetService <IStorageService>(); }
/// <summary> /// Initializes a new instance of the <see cref="Url"/> class. /// </summary> /// <param name="shortener"><see cref="IShortenerService"/> instance.</param> /// <param name="expander"><see cref="IExpanderService"/> instance.</param> public Url(IShortenerService shortener, IExpanderService expander) { this._shortener = shortener ?? throw new ArgumentNullException(nameof(shortener)); this._expander = expander ?? throw new ArgumentNullException(nameof(expander)); }
public UrlController(IShortenerService service) => _service = service ?? throw new ArgumentNullException(nameof(service));
public ShortLinkController(IShortenerService service) { this._service = service; }
public LinksController(IShortenerService service, IMapper mapper, UrlShortnerDbContext dbContext) { _service = service; _mapper = mapper; }
public ShortenerController(IShortenerService shortenerService) { _shortenerService = shortenerService; }
public UrlShortenerController(IShortenerService service, ILogService logService) { _service = service; _logService = logService; }
public UrlController(IShortenerService urlService, IHttpContextAccessor httpContextAccessor) { _urlService = urlService; _httpContextAccessor = httpContextAccessor; }
public ShortenerController(IShortenerService service) { this.service = service; }
public LinkController(IShortenerService linkService, IMapper mapper) { _linkService = linkService; _mapper = mapper; }
public RedirectController(IShortenerService urlService) { _urlService = urlService; }
public ShortenUrlHttpTrigger(IShortenerService service) { this._service = service ?? throw new ArgumentNullException(nameof(service)); }
public HomeController(IShortenerService service) { this._service = service; }