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