コード例 #1
0
ファイル: CdnLink.cs プロジェクト: jackjet870/openapi.net
        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);
        }
コード例 #2
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);
        }