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


C# RuntimeDefinedParameterDictionary类代码示例

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


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

示例1: AddDynamicParameter

        protected static bool AddDynamicParameter(Type type, string name, ref RuntimeDefinedParameterDictionary dic, bool valueFromPipeline)
        {
            bool paramAdded = false;

            if (dic == null || !dic.ContainsKey(name))
            {
                var attrib = new ParameterAttribute
                    {
                        Mandatory = false,
                        ValueFromPipeline = valueFromPipeline,
                    };

                var param = new RuntimeDefinedParameter
                    {
                        IsSet = false,
                        Name = name,
                        ParameterType = type
                    };
                param.Attributes.Add(attrib);

                if (dic == null)
                {
                    dic = new RuntimeDefinedParameterDictionary();
                }
                dic.Add(name, param);
                paramAdded = true;
            }

            return paramAdded;
        }
开发者ID:scjunkie,项目名称:Console,代码行数:30,代码来源:PsSitecoreItemProvider.DynamicParameters.cs

示例2: CreateVirtualMachineScaleSetVMListNextDynamicParameters

        protected object CreateVirtualMachineScaleSetVMListNextDynamicParameters()
        {
            dynamicParameters = new RuntimeDefinedParameterDictionary();
            var pNextPageLink = new RuntimeDefinedParameter();
            pNextPageLink.Name = "NextPageLink";
            pNextPageLink.ParameterType = typeof(string);
            pNextPageLink.Attributes.Add(new ParameterAttribute
            {
                ParameterSetName = "InvokeByDynamicParameters",
                Position = 1,
                Mandatory = true
            });
            pNextPageLink.Attributes.Add(new AllowNullAttribute());
            dynamicParameters.Add("NextPageLink", pNextPageLink);

            var pArgumentList = new RuntimeDefinedParameter();
            pArgumentList.Name = "ArgumentList";
            pArgumentList.ParameterType = typeof(object[]);
            pArgumentList.Attributes.Add(new ParameterAttribute
            {
                ParameterSetName = "InvokeByStaticParameters",
                Position = 2,
                Mandatory = true
            });
            pArgumentList.Attributes.Add(new AllowNullAttribute());
            dynamicParameters.Add("ArgumentList", pArgumentList);

            return dynamicParameters;
        }
开发者ID:FrankSiegemund,项目名称:azure-powershell,代码行数:29,代码来源:VirtualMachineScaleSetVMListNextMethod.cs

示例3: GetDynamicParameters

        public object GetDynamicParameters()
        {
            if (Path == null || !Path.Exists) return GetRuntimeDefinedParameterDictionary(null);

            var tableNames = new List<string>();
            if (TablesCache.ContainsKey(Path.FullName))
            {
                tableNames = TablesCache[Path.FullName];
            }
            else
            {
                try
                {
                    tableNames = DbContext.GetTableNamesContent(Path.FullName);
                    tableNames.Add("All");
                    TablesCache.Add(Path.FullName, tableNames);
                }
                catch (Exception e)
                {
                }
            }

            _staticStroage = GetRuntimeDefinedParameterDictionary(tableNames);
            return _staticStroage;
        }
开发者ID:waqasilyas,项目名称:SQLite-Tools,代码行数:25,代码来源:SelectSQlite.cs

示例4: CreateHostedServiceListExtensionsDynamicParameters

        protected object CreateHostedServiceListExtensionsDynamicParameters()
        {
            dynamicParameters = new RuntimeDefinedParameterDictionary();
            var pServiceName = new RuntimeDefinedParameter();
            pServiceName.Name = "ServiceName";
            pServiceName.ParameterType = typeof(System.String);
            pServiceName.Attributes.Add(new ParameterAttribute
            {
                ParameterSetName = "InvokeByDynamicParameters",
                Position = 1,
                Mandatory = true
            });
            pServiceName.Attributes.Add(new AllowNullAttribute());
            dynamicParameters.Add("ServiceName", pServiceName);

            var pArgumentList = new RuntimeDefinedParameter();
            pArgumentList.Name = "ArgumentList";
            pArgumentList.ParameterType = typeof(object[]);
            pArgumentList.Attributes.Add(new ParameterAttribute
            {
                ParameterSetName = "InvokeByStaticParameters",
                Position = 2,
                Mandatory = true
            });
            pArgumentList.Attributes.Add(new AllowNullAttribute());
            dynamicParameters.Add("ArgumentList", pArgumentList);

            return dynamicParameters;
        }
开发者ID:docschmidt,项目名称:azure-powershell,代码行数:29,代码来源:HostedServiceListExtensionsMethod.cs

示例5: CreateExtensionImageRegisterDynamicParameters

        protected object CreateExtensionImageRegisterDynamicParameters()
        {
            dynamicParameters = new RuntimeDefinedParameterDictionary();
            var pParameters = new RuntimeDefinedParameter();
            pParameters.Name = "ExtensionImageRegisterParameters";
            pParameters.ParameterType = typeof(Microsoft.WindowsAzure.Management.Compute.Models.ExtensionImageRegisterParameters);
            pParameters.Attributes.Add(new ParameterAttribute
            {
                ParameterSetName = "InvokeByDynamicParameters",
                Position = 1,
                Mandatory = true
            });
            pParameters.Attributes.Add(new AllowNullAttribute());
            dynamicParameters.Add("ExtensionImageRegisterParameters", pParameters);

            var pArgumentList = new RuntimeDefinedParameter();
            pArgumentList.Name = "ArgumentList";
            pArgumentList.ParameterType = typeof(object[]);
            pArgumentList.Attributes.Add(new ParameterAttribute
            {
                ParameterSetName = "InvokeByStaticParameters",
                Position = 2,
                Mandatory = true
            });
            pArgumentList.Attributes.Add(new AllowNullAttribute());
            dynamicParameters.Add("ArgumentList", pArgumentList);

            return dynamicParameters;
        }
开发者ID:docschmidt,项目名称:azure-powershell,代码行数:29,代码来源:ExtensionImageRegisterMethod.cs

示例6: RuntimeDefinedParameterBinder

        /// <summary>
        /// Constructs the parameter binder with the specified type metadata. The binder is only valid
        /// for a single instance of a bindable runtime-defined parameter collection and only for the duration of a command.
        /// </summary>
        /// 
        /// <param name="target">
        /// The target runtime-defined parameter collection that the parameter values will be bound to.
        /// </param>
        /// 
        /// <param name="command">
        /// An instance of the command so that attributes can access the context.
        /// </param>
        /// 
        /// <param name="commandLineParameters">
        /// The Command line parameter collection to update...
        /// </param>
        /// 
        internal RuntimeDefinedParameterBinder(
            RuntimeDefinedParameterDictionary target,
            InternalCommand command,
            CommandLineParameters commandLineParameters)
            : base(target, command.MyInvocation, command.Context, command)
        {
            // NTRAID#Windows Out Of Band Releases-927103-2006/01/25-JonN
            foreach (var pair in target)
            {
                string key = pair.Key;
                RuntimeDefinedParameter pp = pair.Value;
                string ppName = (null == pp) ? null : pp.Name;
                if (null == pp || key != ppName)
                {
                    ParameterBindingException bindingException =
                        new ParameterBindingException(
                            ErrorCategory.InvalidArgument,
                            command.MyInvocation,
                            null,
                            ppName,
                            null,
                            null,
                            ParameterBinderStrings.RuntimeDefinedParameterNameMismatch,
                            "RuntimeDefinedParameterNameMismatch",
                            key);

                    throw bindingException;
                }
            }
            this.CommandLineParameters = commandLineParameters;
        }
开发者ID:40a,项目名称:PowerShell,代码行数:48,代码来源:PseudoParameterBinder.cs

示例7: CreateVirtualMachineOSImageGetDetailsDynamicParameters

        protected object CreateVirtualMachineOSImageGetDetailsDynamicParameters()
        {
            dynamicParameters = new RuntimeDefinedParameterDictionary();
            var pImageName = new RuntimeDefinedParameter();
            pImageName.Name = "ImageName";
            pImageName.ParameterType = typeof(System.String);
            pImageName.Attributes.Add(new ParameterAttribute
            {
                ParameterSetName = "InvokeByDynamicParameters",
                Position = 1,
                Mandatory = true
            });
            pImageName.Attributes.Add(new AllowNullAttribute());
            dynamicParameters.Add("ImageName", pImageName);

            var pArgumentList = new RuntimeDefinedParameter();
            pArgumentList.Name = "ArgumentList";
            pArgumentList.ParameterType = typeof(object[]);
            pArgumentList.Attributes.Add(new ParameterAttribute
            {
                ParameterSetName = "InvokeByStaticParameters",
                Position = 2,
                Mandatory = true
            });
            pArgumentList.Attributes.Add(new AllowNullAttribute());
            dynamicParameters.Add("ArgumentList", pArgumentList);

            return dynamicParameters;
        }
开发者ID:docschmidt,项目名称:azure-powershell,代码行数:29,代码来源:VirtualMachineOSImageGetDetailsMethod.cs

示例8: CreateVirtualMachineScaleSetListDynamicParameters

        protected object CreateVirtualMachineScaleSetListDynamicParameters()
        {
            dynamicParameters = new RuntimeDefinedParameterDictionary();
            var pResourceGroupName = new RuntimeDefinedParameter();
            pResourceGroupName.Name = "ResourceGroupName";
            pResourceGroupName.ParameterType = typeof(string);
            pResourceGroupName.Attributes.Add(new ParameterAttribute
            {
                ParameterSetName = "InvokeByDynamicParameters",
                Position = 1,
                Mandatory = true
            });
            pResourceGroupName.Attributes.Add(new AllowNullAttribute());
            dynamicParameters.Add("ResourceGroupName", pResourceGroupName);

            var pArgumentList = new RuntimeDefinedParameter();
            pArgumentList.Name = "ArgumentList";
            pArgumentList.ParameterType = typeof(object[]);
            pArgumentList.Attributes.Add(new ParameterAttribute
            {
                ParameterSetName = "InvokeByStaticParameters",
                Position = 2,
                Mandatory = true
            });
            pArgumentList.Attributes.Add(new AllowNullAttribute());
            dynamicParameters.Add("ArgumentList", pArgumentList);

            return dynamicParameters;
        }
开发者ID:FrankSiegemund,项目名称:azure-powershell,代码行数:29,代码来源:VirtualMachineScaleSetListMethod.cs

示例9: CreateForNewItem

        public RuntimeDefinedParameterDictionary CreateForNewItem()
        {
            var parameters = new RuntimeDefinedParameterDictionary();

            var attrs = from row in _columns
                        let nullable = (bool)row["IS_NULLABLE"] 
                        let primaryKey = (bool)row["PRIMARY_KEY"]
                        let columnName = row["COLUMN_NAME"].ToString()
                        let dataType = ConvertSqliteTypeToType( row["DATA_TYPE"].ToString() )
                        select new RuntimeDefinedParameter(
                            columnName,
                            dataType,
                            new Collection<Attribute>
                                    {
                                        new ParameterAttribute()
                                            {
                                                Mandatory = ! nullable && ! primaryKey,
                                                ValueFromPipelineByPropertyName = true,                                                
                                            },
                                            
                                    }
                            );

            attrs.ToList().ForEach(attr => parameters.Add(attr.Name, attr));
            return parameters;
        }
开发者ID:nickchal,项目名称:pash,代码行数:26,代码来源:DynamicParametersFactory.cs

示例10: NewDriveDynamicParameters

 protected override object NewDriveDynamicParameters()
 {
     try{
         WriteVerbose("TmxProvider::NewDriveDynamicParameters()");
         dynamicParameters =
             new RuntimeDefinedParameterDictionary();
         var atts1 = new Collection<Attribute>();
         var parameterAttribute1 = new ParameterAttribute {Mandatory = true};
         //ParameterAttribute parameterAttribute1 = new ParameterAttribute();
         //parameterAttribute1.Mandatory = true;
         //parameterAttribute2.ParameterSetName = "WindowNameParameterSet";
         atts1.Add(parameterAttribute1);
         var attr1 = new AllowEmptyStringAttribute();
         atts1.Add(attr1);
         dynamicParameters.Add(
             "windowName", 
             new RuntimeDefinedParameter(
                 "windowName", 
                 typeof(string), 
                 atts1));
         
         var atts2 = new Collection<Attribute>();
         var parameterAttribute2 = new ParameterAttribute {Mandatory = true};
         //ParameterAttribute parameterAttribute2 = new ParameterAttribute();
         //parameterAttribute2.Mandatory = true;
         //parameterAttribute2.ParameterSetName = "ProcessNameParameterSet";
         atts2.Add(parameterAttribute2);
         var attr2 = new AllowEmptyStringAttribute();
         atts2.Add(attr2);
         dynamicParameters.Add(
             "processName", 
             new RuntimeDefinedParameter(
                 "processName", 
                 typeof(string), 
                 atts2));
         
         var atts3 = new Collection<Attribute>();
         var parameterAttribute3 = new ParameterAttribute {Mandatory = true};
         //ParameterAttribute parameterAttribute3 = new ParameterAttribute();
         //parameterAttribute3.Mandatory = true;
         //parameterAttribute3.ParameterSetName = "ProcessIdParameterSet";
         atts3.Add(parameterAttribute3);
         var attr3 = new AllowEmptyStringAttribute();
         atts3.Add(attr3);
         dynamicParameters.Add(
             "processId", 
             new RuntimeDefinedParameter(
                 "processId", 
                 typeof(int), 
                 atts3));
         
         return dynamicParameters;
     }
     catch (Exception e) {
         WriteVerbose(e.Message);
         WriteVerbose("TmxProvider::NewDriveDynamicParameters()");
         return null;
     }
 }
开发者ID:MatkoHanus,项目名称:STUPS,代码行数:59,代码来源:TMXProvider.cs

示例11: GetDynamicParameters

        public object GetDynamicParameters()
        {
            RuntimeDefinedParameterDictionary parameters = new RuntimeDefinedParameterDictionary();

            foreach(IDynamicParameter dynamicParameter in DynamicParameters)
            {
                dynamicParameter.AddRuntimeDefinedParameterTo(parameters);
            }

            return parameters;
        }
开发者ID:NiklausMaurer,项目名称:BranchingModule,代码行数:11,代码来源:BranchingModulePSCmdletBase.cs

示例12: InternalParameterMetadata

 internal InternalParameterMetadata(RuntimeDefinedParameterDictionary runtimeDefinedParameters, bool processingDynamicParameters, bool checkNames)
 {
     this.typeName = string.Empty;
     this.bindableParameters = new Dictionary<string, CompiledCommandParameter>(StringComparer.OrdinalIgnoreCase);
     this.aliasedParameters = new Dictionary<string, CompiledCommandParameter>(StringComparer.OrdinalIgnoreCase);
     if (runtimeDefinedParameters == null)
     {
         throw PSTraceSource.NewArgumentNullException("runtimeDefinedParameters");
     }
     this.ConstructCompiledParametersUsingRuntimeDefinedParameters(runtimeDefinedParameters, processingDynamicParameters, checkNames);
 }
开发者ID:nickchal,项目名称:pash,代码行数:11,代码来源:InternalParameterMetadata.cs

示例13: ConvertDynamicParameters

        protected static object[] ConvertDynamicParameters(RuntimeDefinedParameterDictionary parameters)
        {
            List<object> paramList = new List<object>();

            foreach (var param in parameters)
            {
                paramList.Add(param.Value.Value);
            }

            return paramList.ToArray();
        }
开发者ID:docschmidt,项目名称:azure-powershell,代码行数:11,代码来源:InvokeAzureComputeMethodCmdlet.cs

示例14: CreateContainerServiceCreateOrUpdateDynamicParameters

        protected object CreateContainerServiceCreateOrUpdateDynamicParameters()
        {
            dynamicParameters = new RuntimeDefinedParameterDictionary();
            var pResourceGroupName = new RuntimeDefinedParameter();
            pResourceGroupName.Name = "ResourceGroupName";
            pResourceGroupName.ParameterType = typeof(string);
            pResourceGroupName.Attributes.Add(new ParameterAttribute
            {
                ParameterSetName = "InvokeByDynamicParameters",
                Position = 1,
                Mandatory = true
            });
            pResourceGroupName.Attributes.Add(new AllowNullAttribute());
            dynamicParameters.Add("ResourceGroupName", pResourceGroupName);

            var pContainerServiceName = new RuntimeDefinedParameter();
            pContainerServiceName.Name = "Name";
            pContainerServiceName.ParameterType = typeof(string);
            pContainerServiceName.Attributes.Add(new ParameterAttribute
            {
                ParameterSetName = "InvokeByDynamicParameters",
                Position = 2,
                Mandatory = true
            });
            pContainerServiceName.Attributes.Add(new AllowNullAttribute());
            dynamicParameters.Add("Name", pContainerServiceName);

            var pParameters = new RuntimeDefinedParameter();
            pParameters.Name = "ContainerService";
            pParameters.ParameterType = typeof(ContainerService);
            pParameters.Attributes.Add(new ParameterAttribute
            {
                ParameterSetName = "InvokeByDynamicParameters",
                Position = 3,
                Mandatory = true
            });
            pParameters.Attributes.Add(new AllowNullAttribute());
            dynamicParameters.Add("ContainerService", pParameters);

            var pArgumentList = new RuntimeDefinedParameter();
            pArgumentList.Name = "ArgumentList";
            pArgumentList.ParameterType = typeof(object[]);
            pArgumentList.Attributes.Add(new ParameterAttribute
            {
                ParameterSetName = "InvokeByStaticParameters",
                Position = 4,
                Mandatory = true
            });
            pArgumentList.Attributes.Add(new AllowNullAttribute());
            dynamicParameters.Add("ArgumentList", pArgumentList);

            return dynamicParameters;
        }
开发者ID:brnleehng,项目名称:azure-powershell,代码行数:53,代码来源:ContainerServiceCreateOrUpdateMethod.cs

示例15: CreateVirtualMachineRestartDynamicParameters

        protected object CreateVirtualMachineRestartDynamicParameters()
        {
            dynamicParameters = new RuntimeDefinedParameterDictionary();
            var pServiceName = new RuntimeDefinedParameter();
            pServiceName.Name = "ServiceName";
            pServiceName.ParameterType = typeof(System.String);
            pServiceName.Attributes.Add(new ParameterAttribute
            {
                ParameterSetName = "InvokeByDynamicParameters",
                Position = 1,
                Mandatory = true
            });
            pServiceName.Attributes.Add(new AllowNullAttribute());
            dynamicParameters.Add("ServiceName", pServiceName);

            var pDeploymentName = new RuntimeDefinedParameter();
            pDeploymentName.Name = "DeploymentName";
            pDeploymentName.ParameterType = typeof(System.String);
            pDeploymentName.Attributes.Add(new ParameterAttribute
            {
                ParameterSetName = "InvokeByDynamicParameters",
                Position = 2,
                Mandatory = true
            });
            pDeploymentName.Attributes.Add(new AllowNullAttribute());
            dynamicParameters.Add("DeploymentName", pDeploymentName);

            var pVirtualMachineName = new RuntimeDefinedParameter();
            pVirtualMachineName.Name = "VirtualMachineName";
            pVirtualMachineName.ParameterType = typeof(System.String);
            pVirtualMachineName.Attributes.Add(new ParameterAttribute
            {
                ParameterSetName = "InvokeByDynamicParameters",
                Position = 3,
                Mandatory = true
            });
            pVirtualMachineName.Attributes.Add(new AllowNullAttribute());
            dynamicParameters.Add("VirtualMachineName", pVirtualMachineName);

            var pArgumentList = new RuntimeDefinedParameter();
            pArgumentList.Name = "ArgumentList";
            pArgumentList.ParameterType = typeof(object[]);
            pArgumentList.Attributes.Add(new ParameterAttribute
            {
                ParameterSetName = "InvokeByStaticParameters",
                Position = 4,
                Mandatory = true
            });
            pArgumentList.Attributes.Add(new AllowNullAttribute());
            dynamicParameters.Add("ArgumentList", pArgumentList);

            return dynamicParameters;
        }
开发者ID:FrankSiegemund,项目名称:azure-powershell,代码行数:53,代码来源:VirtualMachineRestartMethod.cs


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