当前位置: 首页>>代码示例>>C#>>正文


C# RuntimeDefinedParameterDictionary.AddRange方法代码示例

本文整理汇总了C#中RuntimeDefinedParameterDictionary.AddRange方法的典型用法代码示例。如果您正苦于以下问题:C# RuntimeDefinedParameterDictionary.AddRange方法的具体用法?C# RuntimeDefinedParameterDictionary.AddRange怎么用?C# RuntimeDefinedParameterDictionary.AddRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RuntimeDefinedParameterDictionary的用法示例。


在下文中一共展示了RuntimeDefinedParameterDictionary.AddRange方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetDynamicParameters

        /// <summary>
        /// Get conditional parameters depending on specified ErrorAction.
        /// </summary>
        /// <returns>List of Powershell dynamic parameters.</returns>
        public object GetDynamicParameters()
        {
            var runtimeDefinedParameterDictionary = new RuntimeDefinedParameterDictionary();

            if (!string.IsNullOrWhiteSpace(this.ErrorActionType))
            {
                runtimeDefinedParameterDictionary.AddRange(this.AddErrorActionParameters(this.ErrorActionType, create: false));
            }

            return runtimeDefinedParameterDictionary;
        }
开发者ID:Azure,项目名称:azure-powershell,代码行数:15,代码来源:UpdateAzureSchedulerServiceBusTopicJobCommand.cs

示例2: GetDynamicParameters

        /// <summary>
        /// Get conditional parameters depending on specified ErrorAction and/or type of http authentication.
        /// </summary>
        /// <returns>List of Powershell dynamic parameters.</returns>
        public object GetDynamicParameters()
        {
            var runtimeDefinedParameterDictionary = new RuntimeDefinedParameterDictionary();

            if (!string.IsNullOrWhiteSpace(this.HttpAuthenticationType))
            {
                if (this.HttpAuthenticationType.Equals(Constants.HttpAuthenticationClientCertificate, StringComparison.InvariantCultureIgnoreCase))
                {
                    runtimeDefinedParameterDictionary.AddRange(this.JobDynamicParameters.AddHttpClientCertificateAuthenticationTypeParameters());
                }
                else if (this.HttpAuthenticationType.Equals(Constants.HttpAuthenticationBasic, StringComparison.InvariantCultureIgnoreCase))
                {
                    runtimeDefinedParameterDictionary.AddRange(this.JobDynamicParameters.AddHttpBasicAuthenticationTypeParameters());
                }
                else if (this.HttpAuthenticationType.Equals(Constants.HttpAuthenticationActiveDirectoryOAuth, StringComparison.InvariantCultureIgnoreCase))
                {
                    runtimeDefinedParameterDictionary.AddRange(this.JobDynamicParameters.AddHttpActiveDirectoryOAuthAuthenticationTypeParameters());
                }
            }

            if (!string.IsNullOrWhiteSpace(this.ErrorActionType))
            {
                runtimeDefinedParameterDictionary.AddRange(this.AddErrorActionParameters(this.ErrorActionType, create: true));
            }

            return runtimeDefinedParameterDictionary;
        }
开发者ID:Azure,项目名称:azure-powershell,代码行数:31,代码来源:NewAzureSchedulerHttpJobCommand.cs

示例3: AddHttpErrorActionParameters

        /// <summary>
        /// Adds http error action parameters to PowerShell.
        /// </summary>
        /// <param name="create">true if parameters added for create scenario and false for update scenario.</param>
        /// <returns>PowerShell parameters.</returns>
        internal RuntimeDefinedParameterDictionary AddHttpErrorActionParameters(bool create = true)
        {
            var errorActionMethodAttributes = new Collection<Attribute>
            {
                new ParameterAttribute
                {
                    Mandatory = create ? true : false,
                    HelpMessage = "The Method for Http and Https Action types (GET, PUT, POST, HEAD or DELETE).",
                },
                new ValidateSetAttribute(Constants.HttpMethodGET, Constants.HttpMethodPUT, Constants.HttpMethodPOST, Constants.HttpMethodDELETE)
                {
                    IgnoreCase = true,
                }
            };

            var errorActionUriAttributes = new Collection<Attribute>
            {
                new ParameterAttribute
                {
                    Mandatory = create ? true : false,
                    HelpMessage = "The Uri for error job action.",
                },
                new ValidateNotNullOrEmptyAttribute()
            };

            var errorActionRequestBodyAttributes = new Collection<Attribute>
            {
                new ParameterAttribute
                {
                    Mandatory = false,
                    HelpMessage = "The Body for PUT and POST job actions.",
                },
                new ValidateNotNullOrEmptyAttribute()
            };

            var errorActionHeadersAttributes = new Collection<Attribute>
            {
                new ParameterAttribute
                {
                    Mandatory = false,
                    HelpMessage = "The header collection."
                },
                new ValidateNotNullOrEmptyAttribute()
            };

            var errorActionHttpAuthenticationTypeAttributes = new Collection<Attribute>
            {
                new ParameterAttribute
                {
                    Mandatory = false,
                    HelpMessage = "The Http Authentication type."
                },
                new ValidateSetAttribute(Constants.HttpAuthenticationNone, Constants.HttpAuthenticationClientCertificate, Constants.HttpAuthenticationActiveDirectoryOAuth, Constants.HttpAuthenticationBasic)
                {
                    IgnoreCase = true
                }
            };

            this._errorActionMethod = new RuntimeDefinedParameter("ErrorActionMethod", typeof(string), errorActionMethodAttributes);
            this._errorActionUri = new RuntimeDefinedParameter("ErrorActionUri", typeof(Uri), errorActionUriAttributes);
            this._errorActionRequestBody = new RuntimeDefinedParameter("ErrorActionRequestBody", typeof(string), errorActionRequestBodyAttributes);
            this._errorActionHeaders = new RuntimeDefinedParameter("ErrorActionHeaders", typeof(Hashtable), errorActionHeadersAttributes);
            this._errorActionHttpAuthenticationType = new RuntimeDefinedParameter("ErrorActionHttpAuthenticationType", typeof(string), errorActionHttpAuthenticationTypeAttributes);

            var runtimeDefinedParameterDictionary = new RuntimeDefinedParameterDictionary();
            runtimeDefinedParameterDictionary.Add("ErrorActionMethod", this._errorActionMethod);
            runtimeDefinedParameterDictionary.Add("ErrorActionUri", this._errorActionUri);
            runtimeDefinedParameterDictionary.Add("ErrorActionRequestBody", this._errorActionRequestBody);
            runtimeDefinedParameterDictionary.Add("ErrorActionHeaders", this._errorActionHeaders);
            runtimeDefinedParameterDictionary.Add("ErrorActionHttpAuthenticationType", this._errorActionHttpAuthenticationType);

            runtimeDefinedParameterDictionary.AddRange(this.AddHttpErrorActionClientCertificateAuthenticationTypeParameters());
            runtimeDefinedParameterDictionary.AddRange(this.AddHttpErrorActionBasicAuthenticationTypeParameters());
            runtimeDefinedParameterDictionary.AddRange(this.AddHttpErrorActionActiveDirectoryOAuthAuthenticationTypeParameters());

            return runtimeDefinedParameterDictionary;
        }
开发者ID:Azure,项目名称:azure-powershell,代码行数:82,代码来源:JobDynamicParameters.Http.cs

示例4: AddServiceBusTopicErrorActionParameters

        /// <summary>
        /// Add service bus topic error action parameters.
        /// </summary>
        /// <param name="create">true if parameters added for create scenario and false for update scenario.</param>
        /// <returns>PowerShell parameters.</returns>
        internal RuntimeDefinedParameterDictionary AddServiceBusTopicErrorActionParameters(bool create = true)
        {
            var errorActionServiceBusTopicPathAttributes = new Collection<Attribute>
            {
                new ParameterAttribute
                {
                    Mandatory = create ? true : false,
                    HelpMessage = "Service bus topic path.",
                },
                new ValidateNotNullOrEmptyAttribute()
            };

            this._errorActionServiceBusTopicPath = new RuntimeDefinedParameter("ErrorActionServiceBusTopicPath", typeof(string), errorActionServiceBusTopicPathAttributes);

            var runTimeDefinedParameterDictionary = new RuntimeDefinedParameterDictionary();
            runTimeDefinedParameterDictionary.Add("ErrorActionServiceBusTopicPath", this._errorActionServiceBusTopicPath);
            runTimeDefinedParameterDictionary.AddRange(this.AddServiceBusErrorActionParameters(create));

            return runTimeDefinedParameterDictionary;
        }
开发者ID:Azure,项目名称:azure-powershell,代码行数:25,代码来源:JobDynamicParameters.ServiceBus.cs

示例5: CloneWithIsolatedParameterDefinition

        public static ScriptBlock CloneWithIsolatedParameterDefinition(this ScriptBlock source)
        {
            var destination = source.Clone(false);

            var srcParamList = source.Get_RuntimeDefinedParameterList();
            var dstParamList = destination.Get_RuntimeDefinedParameterList();
            dstParamList = new List<RuntimeDefinedParameter>(srcParamList);
            destination.Set__runtimeDefinedParameterList(dstParamList);

            var srcParamDic = source.Get_RuntimeDefinedParameters();
            var dstParamDic = destination.Get_RuntimeDefinedParameters();
            dstParamDic = new RuntimeDefinedParameterDictionary();
            dstParamDic.AddRange(srcParamDic);
            destination.Set__runtimeDefinedParameters(dstParamDic);

            return destination;
        }
开发者ID:urasandesu,项目名称:Pontine,代码行数:17,代码来源:ScriptBlockMixin.cs

示例6: GetDynamicParameters

        /// <summary>
        /// Get conditional parameters depending on specified ErrorAction and/or type of http authentication.
        /// </summary>
        /// <returns>List of Powershell dynamic parameters.</returns>
        public object GetDynamicParameters()
        {
            var runtimeDefinedParameterDictionary = new RuntimeDefinedParameterDictionary();

            if (!string.IsNullOrWhiteSpace(this.HttpAuthenticationType))
            {
                if (this.HttpAuthenticationType == Constants.HttpAuthenticationClientCertificate)
                {
                    runtimeDefinedParameterDictionary.AddRange(this.JobDynamicParameters.AddHttpClientCertificateAuthenticationTypeParameters(create: false));
                }
                else if (this.HttpAuthenticationType == Constants.HttpAuthenticationBasic)
                {
                    runtimeDefinedParameterDictionary.AddRange(this.JobDynamicParameters.AddHttpBasicAuthenticationTypeParameters(create: false));
                }
                else if (this.HttpAuthenticationType == Constants.HttpAuthenticationActiveDirectoryOAuth)
                {
                    runtimeDefinedParameterDictionary.AddRange(this.JobDynamicParameters.AddHttpActiveDirectoryOAuthAuthenticationTypeParameters(create: false));
                }
            }

            if (!string.IsNullOrWhiteSpace(this.ErrorActionType))
            {
                runtimeDefinedParameterDictionary.AddRange(this.AddErrorActionParameters(this.ErrorActionType, create: false));
            }
            
            return runtimeDefinedParameterDictionary;
        }
开发者ID:Azure,项目名称:azure-powershell,代码行数:31,代码来源:UpdateAzureSchedulerHttpJobCommand.cs

示例7: AddErrorActionParameters

        /// <summary>
        /// Adds error action Powershell Parameters.
        /// </summary>
        /// <param name="errorActionType">Error action type.</param>
        /// <param name="create">true</param>
        /// <returns>PowerShell parameters.</returns>
        public RuntimeDefinedParameterDictionary AddErrorActionParameters(string errorActionType, bool create)
        {
            var runtimeDefinedParameterDictionary = new RuntimeDefinedParameterDictionary();

            if (!string.IsNullOrWhiteSpace(errorActionType))
            {
                if (errorActionType.Equals(Constants.HttpAction, StringComparison.InvariantCultureIgnoreCase))
                {
                    runtimeDefinedParameterDictionary.AddRange(this.JobDynamicParameters.AddHttpErrorActionParameters(create));
                }
                else if (errorActionType.Equals(Constants.StorageQueueAction, StringComparison.InvariantCultureIgnoreCase))
                {
                    runtimeDefinedParameterDictionary.AddRange(this.JobDynamicParameters.AddStorageQueueErrorActionParameters(create));
                }
                else if (errorActionType.Equals(Constants.ServiceBusQueueAction, StringComparison.InvariantCultureIgnoreCase))
                {
                    runtimeDefinedParameterDictionary.AddRange(this.JobDynamicParameters.AddServiceBusQueueErrorActionParameters(create));
                }
                else if (errorActionType.Equals(Constants.ServiceBusTopicAction, StringComparison.InvariantCultureIgnoreCase))
                {
                    runtimeDefinedParameterDictionary.AddRange(this.JobDynamicParameters.AddServiceBusTopicErrorActionParameters(create));
                }
            }

            return runtimeDefinedParameterDictionary;
        }
开发者ID:Azure,项目名称:azure-powershell,代码行数:32,代码来源:JobBaseCmdlet.cs


注:本文中的RuntimeDefinedParameterDictionary.AddRange方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。