public GitHubRepositoryEntityDownloader(RepositoryServiceOptions settings, ILoggerFactory loggerFactory)
        {
            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }
            _settings = settings ?? throw new ArgumentNullException(nameof(settings));

            _logger = loggerFactory.CreateLogger <GitHubRepositoryEntityDownloader>();
        }
        /// <summary>
        /// Creates a new instance of the ServiceBusNotificationService class
        /// </summary>
        public CosmosDbRepositoryService(IOptions <RepositoryServiceOptions> options,
                                         ILogger <CosmosDbRepositoryService <T> > logger)
        {
            if (options?.Value == null)
            {
                throw new ArgumentNullException(nameof(options), "No configuration is defined for the repository service in the appsettings.json.");
            }

            if (options.Value.CosmosDb == null)
            {
                throw new ArgumentNullException(nameof(options), "No CosmosDb element is defined in the configuration for the notification service in the appsettings.json.");
            }

            if (string.IsNullOrWhiteSpace(options.Value.CosmosDb.EndpointUri))
            {
                throw new ArgumentNullException(nameof(options), "No endpoint uri is defined in the configuration of the Cosmos DB notification service in the appsettings.json.");
            }

            if (string.IsNullOrWhiteSpace(options.Value.CosmosDb.PrimaryKey))
            {
                throw new ArgumentNullException(nameof(options), "No primary key is defined in the configuration of the Cosmos DB notification service in the appsettings.json.");
            }

            if (string.IsNullOrWhiteSpace(options.Value.CosmosDb.DatabaseName))
            {
                throw new ArgumentNullException(nameof(options), "No database name is defined in the configuration of the Cosmos DB notification service in the appsettings.json.");
            }

            if (string.IsNullOrWhiteSpace(options.Value.CosmosDb.CollectionName))
            {
                throw new ArgumentNullException(nameof(options), "No collection name is defined in the configuration of the Cosmos DB notification service in the appsettings.json.");
            }

            _repositoryServiceOptions = options.Value;
            _logger = logger;

            _documentClient = new DocumentClient(new Uri(_repositoryServiceOptions.CosmosDb.EndpointUri),
                                                 options.Value.CosmosDb.PrimaryKey,
                                                 new ConnectionPolicy
            {
                //ConnectionMode = ConnectionMode.Direct, // Not supported when running the ASP.NET Core app in a Docker container
                ConnectionProtocol = Protocol.Tcp,
                RequestTimeout     = TimeSpan.FromMinutes(5)
            });
            CreateDatabaseAndDocumentCollectionIfNotExistsAsync().Wait();
        }
 public RepositoryService(IOptions <RepositoryServiceOptions> repositoryServiceOptions)
 {
     this._repositoryServiceOptions = repositoryServiceOptions.Value;
 }