예제 #1
0
 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>();
        }
예제 #3
0
 /// <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));
 }
예제 #4
0
 public UrlController(IShortenerService service) => _service = service ?? throw new ArgumentNullException(nameof(service));
예제 #5
0
 public ShortLinkController(IShortenerService service)
 {
     this._service = service;
 }
예제 #6
0
 public LinksController(IShortenerService service, IMapper mapper, UrlShortnerDbContext dbContext)
 {
     _service = service;
     _mapper  = mapper;
 }
예제 #7
0
 public ShortenerController(IShortenerService shortenerService)
 {
     _shortenerService = shortenerService;
 }
예제 #8
0
 public UrlShortenerController(IShortenerService service, ILogService logService)
 {
     _service    = service;
     _logService = logService;
 }
예제 #9
0
 public UrlController(IShortenerService urlService, IHttpContextAccessor httpContextAccessor)
 {
     _urlService          = urlService;
     _httpContextAccessor = httpContextAccessor;
 }
 public ShortenerController(IShortenerService service)
 {
     this.service = service;
 }
예제 #11
0
 public ShortenerController(IShortenerService service)
 {
     this.service = service;
 }
예제 #12
0
 public LinkController(IShortenerService linkService, IMapper mapper)
 {
     _linkService = linkService;
     _mapper      = mapper;
 }
예제 #13
0
 public RedirectController(IShortenerService urlService)
 {
     _urlService = urlService;
 }
예제 #14
0
 public ShortenUrlHttpTrigger(IShortenerService service)
 {
     this._service = service ?? throw new ArgumentNullException(nameof(service));
 }
예제 #15
0
 public HomeController(IShortenerService service)
 {
     this._service = service;
 }