Beispiel #1
0
        public CdnLink(
            string connectionString,
            ICdnApi api,
            ICdnFtpBox ftp,
            Dictionary <string, string> apiKeysByScacs = null)
        {
            if (string.IsNullOrWhiteSpace(connectionString))
            {
                throw new ArgumentException("Config setting CDNLINK_CONNECTIONSTRING must be populated");
            }
            if (string.IsNullOrWhiteSpace(api.Uri))
            {
                throw new ArgumentException("Config setting CDNLINK_API_URL must be populated");
            }
            if (string.IsNullOrWhiteSpace(ftp.Host))
            {
                throw new ArgumentException("Config setting CDNLINK_FTP_HOST must be populated");
            }
            if (string.IsNullOrWhiteSpace(api.ApiKey) && (apiKeysByScacs == null || apiKeysByScacs.Count == 0))
            {
                throw new ArgumentException("Config setting CDNLINK_API_KEY or apiKeyScacList must be populated");
            }

            ConnectionString = connectionString;
            Api            = api;
            FtpBox         = ftp;
            _apiKeysByScac = apiKeysByScacs;
            _loadIdPrefix  = IsKeyByScacLookupMode
                ? null
                : GetApiKeyScac(api.ApiKey);
        }
        public CdnLink(
            string connectionString,
            ICdnApi api,
            ICdnFtpBox ftp,
            Dictionary<string, string> apiKeysByScacs = null)
        {
            if (string.IsNullOrWhiteSpace(connectionString))
                throw new ArgumentException("Config setting CDNLINK_CONNECTIONSTRING must be populated");
            if (string.IsNullOrWhiteSpace(api.Uri))
                throw new ArgumentException("Config setting CDNLINK_API_URL must be populated");
            if (string.IsNullOrWhiteSpace(ftp.Host))
                throw new ArgumentException("Config setting CDNLINK_FTP_HOST must be populated");
            if (string.IsNullOrWhiteSpace(api.ApiKey) && (apiKeysByScacs == null || apiKeysByScacs.Count == 0))
                throw new ArgumentException("Config setting CDNLINK_API_KEY or apiKeyScacList must be populated");

            ConnectionString = connectionString;
            Api = api;
            FtpBox = ftp;
            _apiKeysByScac = apiKeysByScacs;
            _loadIdPrefix = IsKeyByScacLookupMode
                ? null
                : GetApiKeyScac(api.ApiKey);
        }