コード例 #1
0
        public Task LoadRecSourceAsync(string name, bool replaceExisting, RecSourceParams parameters, TimeSpan timeout, CancellationToken cancellationToken)
        {
            Operation <LoadRecSourceRequest <RecSourceParams> > operation = new Operation <LoadRecSourceRequest <RecSourceParams> >(
                opName: OperationTypes.LoadRecSource,
                payload: new LoadRecSourceRequest <RecSourceParams>(
                    name: name, type: parameters.GetRecSourceTypeName(), replaceExisting: replaceExisting, parameters: parameters
                    )
                );

            return(DoOperationWithoutResponseBodyAsync(operation, timeout, cancellationToken, descriptionForErrors: "loading rec source " + name));
        }
コード例 #2
0
        private static LoadRecSourceRequest ConvertRecSourceSection(IConfigurationSection recSourceSection)
        {
            string recSourceName = recSourceSection.Key;
            string recSourceType = recSourceSection.GetValue <string>("Type");

            if (!RecSourceTypes.LoadRecSourceRequestFactories.TryGetValue(recSourceType, out Func <LoadRecSourceRequest> recSourceRequestFactory))
            {
                throw new Exception(string.Format("There is no rec source type called \"{0}\".", recSourceType));
            }

            LoadRecSourceRequest recSourceRequest = recSourceRequestFactory();

            recSourceRequest.Name = recSourceName;
            recSourceRequest.Type = recSourceType;

            RecSourceParams       recSourceParams = recSourceRequest.GetParams();
            IConfigurationSection paramsSection   = recSourceSection.GetSection("Params");

            paramsSection.Bind(recSourceParams);
            return(recSourceRequest);
        }