本文整理汇总了C#中System.Management.Automation.RuntimeDefinedParameter类的典型用法代码示例。如果您正苦于以下问题:C# RuntimeDefinedParameter类的具体用法?C# RuntimeDefinedParameter怎么用?C# RuntimeDefinedParameter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RuntimeDefinedParameter类属于System.Management.Automation命名空间,在下文中一共展示了RuntimeDefinedParameter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: 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
示例2: 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
示例3: 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
示例4: 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
示例5: 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
示例6: 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
示例7: GetDefaultScriptParameterValue
internal object GetDefaultScriptParameterValue(RuntimeDefinedParameter parameter, IList implicitUsingParameters = null)
{
object obj2 = parameter.Value;
Compiler.DefaultValueExpressionWrapper wrapper = obj2 as Compiler.DefaultValueExpressionWrapper;
if (wrapper != null)
{
obj2 = wrapper.GetValue(base.Context, this.Script.SessionStateInternal, implicitUsingParameters);
}
return obj2;
}
开发者ID:nickchal,项目名称:pash,代码行数:10,代码来源:ScriptParameterBinder.cs
示例8: 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
示例9: CreateVirtualMachineStartRolesDynamicParameters
protected object CreateVirtualMachineStartRolesDynamicParameters()
{
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 pParameters = new RuntimeDefinedParameter();
pParameters.Name = "VirtualMachineStartRolesParameters";
pParameters.ParameterType = typeof(Microsoft.WindowsAzure.Management.Compute.Models.VirtualMachineStartRolesParameters);
pParameters.Attributes.Add(new ParameterAttribute
{
ParameterSetName = "InvokeByDynamicParameters",
Position = 3,
Mandatory = true
});
pParameters.Attributes.Add(new AllowNullAttribute());
dynamicParameters.Add("VirtualMachineStartRolesParameters", 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:FrankSiegemund,项目名称:azure-powershell,代码行数:53,代码来源:VirtualMachineStartRolesMethod.cs
示例10: CompiledCommandParameter
/// <summary>
/// Constructs an instance of the CompiledCommandAttribute using the specified
/// runtime-defined parameter
/// </summary>
///
/// <param name="runtimeDefinedParameter">
/// A runtime defined parameter that contains the definition of the parameter and its
/// metadata.
/// </param>
///
/// <param name="processingDynamicParameters">
/// True if dynamic parameters are being processed, or false otherwise.
/// </param>
///
/// <exception cref="ArgumentNullException">
/// If <paramref name="runtimeDefinedParameter"/> is null.
/// </exception>
///
/// <exception cref="MetadataException">
/// If the parameter has more than one <see cref="ParameterAttribute">ParameterAttribute</see>
/// that defines the same parameter-set name.
/// </exception>
///
internal CompiledCommandParameter(RuntimeDefinedParameter runtimeDefinedParameter, bool processingDynamicParameters)
{
if (runtimeDefinedParameter == null)
{
throw PSTraceSource.NewArgumentNullException("runtimeDefinedParameter");
}
this.Name = runtimeDefinedParameter.Name;
this.Type = runtimeDefinedParameter.ParameterType;
this.IsDynamic = processingDynamicParameters;
this.CollectionTypeInformation = new ParameterCollectionTypeInformation(runtimeDefinedParameter.ParameterType);
this.CompiledAttributes = new Collection<Attribute>();
this.ParameterSetData = new Dictionary<string, ParameterSetSpecificMetadata>(StringComparer.OrdinalIgnoreCase);
Collection<ValidateArgumentsAttribute> validationAttributes = null;
Collection<ArgumentTransformationAttribute> argTransformationAttributes = null;
string[] aliases = null;
// First, process attributes that aren't type conversions
foreach (Attribute attribute in runtimeDefinedParameter.Attributes)
{
if (!(attribute is ArgumentTypeConverterAttribute))
{
ProcessAttribute(runtimeDefinedParameter.Name, attribute, ref validationAttributes, ref argTransformationAttributes, ref aliases);
}
}
// If this is a PSCredential type and they haven't added any argument transformation attributes,
// add one for credential transformation
if ((this.Type == typeof(PSCredential)) && argTransformationAttributes == null)
{
ProcessAttribute(runtimeDefinedParameter.Name, new CredentialAttribute(), ref validationAttributes, ref argTransformationAttributes, ref aliases);
}
// Now process type converters
foreach (ArgumentTypeConverterAttribute attribute in runtimeDefinedParameter.Attributes.OfType<ArgumentTypeConverterAttribute>())
{
ProcessAttribute(runtimeDefinedParameter.Name, attribute, ref validationAttributes, ref argTransformationAttributes, ref aliases);
}
this.ValidationAttributes = validationAttributes == null
? Utils.EmptyArray<ValidateArgumentsAttribute>()
: validationAttributes.ToArray();
this.ArgumentTransformationAttributes = argTransformationAttributes == null
? Utils.EmptyArray<ArgumentTransformationAttribute>()
: argTransformationAttributes.ToArray();
this.Aliases = aliases == null
? Utils.EmptyArray<string>()
: aliases.ToArray();
}
开发者ID:40a,项目名称:PowerShell,代码行数:76,代码来源:CompiledCommandParameter.cs
示例11: 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
示例12: CreateExtensionImageUnregisterDynamicParameters
protected object CreateExtensionImageUnregisterDynamicParameters()
{
dynamicParameters = new RuntimeDefinedParameterDictionary();
var pProviderNamespace = new RuntimeDefinedParameter();
pProviderNamespace.Name = "ProviderNamespace";
pProviderNamespace.ParameterType = typeof(System.String);
pProviderNamespace.Attributes.Add(new ParameterAttribute
{
ParameterSetName = "InvokeByDynamicParameters",
Position = 1,
Mandatory = true
});
pProviderNamespace.Attributes.Add(new AllowNullAttribute());
dynamicParameters.Add("ProviderNamespace", pProviderNamespace);
var pType = new RuntimeDefinedParameter();
pType.Name = "Type";
pType.ParameterType = typeof(System.String);
pType.Attributes.Add(new ParameterAttribute
{
ParameterSetName = "InvokeByDynamicParameters",
Position = 2,
Mandatory = true
});
pType.Attributes.Add(new AllowNullAttribute());
dynamicParameters.Add("Type", pType);
var pVersion = new RuntimeDefinedParameter();
pVersion.Name = "Version";
pVersion.ParameterType = typeof(System.String);
pVersion.Attributes.Add(new ParameterAttribute
{
ParameterSetName = "InvokeByDynamicParameters",
Position = 3,
Mandatory = true
});
pVersion.Attributes.Add(new AllowNullAttribute());
dynamicParameters.Add("Version", pVersion);
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:docschmidt,项目名称:azure-powershell,代码行数:53,代码来源:ExtensionImageUnregisterMethod.cs
示例13: CreateOperatingSystemListDynamicParameters
protected object CreateOperatingSystemListDynamicParameters()
{
dynamicParameters = new RuntimeDefinedParameterDictionary();
var pArgumentList = new RuntimeDefinedParameter();
pArgumentList.Name = "ArgumentList";
pArgumentList.ParameterType = typeof(object[]);
pArgumentList.Attributes.Add(new ParameterAttribute
{
ParameterSetName = "InvokeByStaticParameters",
Position = 1,
Mandatory = true
});
pArgumentList.Attributes.Add(new AllowNullAttribute());
dynamicParameters.Add("ArgumentList", pArgumentList);
return dynamicParameters;
}
开发者ID:FrankSiegemund,项目名称:azure-powershell,代码行数:17,代码来源:OperatingSystemListMethod.cs
示例14: CompiledCommandParameter
internal CompiledCommandParameter(RuntimeDefinedParameter runtimeDefinedParameter, bool processingDynamicParameters)
{
this.name = string.Empty;
this.typeName = string.Empty;
this.argumentTransformationAttributes = new Collection<ArgumentTransformationAttribute>();
this.validationAttributes = new Collection<ValidateArgumentsAttribute>();
this.aliases = new Collection<string>();
if (runtimeDefinedParameter == null)
{
throw PSTraceSource.NewArgumentNullException("runtimeDefinedParameter");
}
this.name = runtimeDefinedParameter.Name;
this.type = runtimeDefinedParameter.ParameterType;
this.isDynamic = processingDynamicParameters;
this.collectionTypeInformation = new ParameterCollectionTypeInformation(runtimeDefinedParameter.ParameterType);
this.ConstructCompiledAttributesUsingRuntimeDefinedParameter(runtimeDefinedParameter);
}
开发者ID:nickchal,项目名称:pash,代码行数:17,代码来源:CompiledCommandParameter.cs
示例15: CreateVirtualMachineExtensionListVersionsDynamicParameters
protected object CreateVirtualMachineExtensionListVersionsDynamicParameters()
{
dynamicParameters = new RuntimeDefinedParameterDictionary();
var pPublisherName = new RuntimeDefinedParameter();
pPublisherName.Name = "PublisherName";
pPublisherName.ParameterType = typeof(System.String);
pPublisherName.Attributes.Add(new ParameterAttribute
{
ParameterSetName = "InvokeByDynamicParameters",
Position = 1,
Mandatory = true
});
pPublisherName.Attributes.Add(new AllowNullAttribute());
dynamicParameters.Add("PublisherName", pPublisherName);
var pExtensionName = new RuntimeDefinedParameter();
pExtensionName.Name = "ExtensionName";
pExtensionName.ParameterType = typeof(System.String);
pExtensionName.Attributes.Add(new ParameterAttribute
{
ParameterSetName = "InvokeByDynamicParameters",
Position = 2,
Mandatory = true
});
pExtensionName.Attributes.Add(new AllowNullAttribute());
dynamicParameters.Add("ExtensionName", pExtensionName);
var pArgumentList = new RuntimeDefinedParameter();
pArgumentList.Name = "ArgumentList";
pArgumentList.ParameterType = typeof(object[]);
pArgumentList.Attributes.Add(new ParameterAttribute
{
ParameterSetName = "InvokeByStaticParameters",
Position = 3,
Mandatory = true
});
pArgumentList.Attributes.Add(new AllowNullAttribute());
dynamicParameters.Add("ArgumentList", pArgumentList);
return dynamicParameters;
}
开发者ID:docschmidt,项目名称:azure-powershell,代码行数:41,代码来源:VirtualMachineExtensionListVersionsMethod.cs
示例16: CreateVirtualMachineVMImageDeleteDynamicParameters
protected object CreateVirtualMachineVMImageDeleteDynamicParameters()
{
dynamicParameters = new RuntimeDefinedParameterDictionary();
var pVMImageName = new RuntimeDefinedParameter();
pVMImageName.Name = "VMImageName";
pVMImageName.ParameterType = typeof(System.String);
pVMImageName.Attributes.Add(new ParameterAttribute
{
ParameterSetName = "InvokeByDynamicParameters",
Position = 1,
Mandatory = true
});
pVMImageName.Attributes.Add(new AllowNullAttribute());
dynamicParameters.Add("VMImageName", pVMImageName);
var pDeleteFromStorage = new RuntimeDefinedParameter();
pDeleteFromStorage.Name = "DeleteFromStorage";
pDeleteFromStorage.ParameterType = typeof(System.Boolean);
pDeleteFromStorage.Attributes.Add(new ParameterAttribute
{
ParameterSetName = "InvokeByDynamicParameters",
Position = 2,
Mandatory = true
});
pDeleteFromStorage.Attributes.Add(new AllowNullAttribute());
dynamicParameters.Add("DeleteFromStorage", pDeleteFromStorage);
var pArgumentList = new RuntimeDefinedParameter();
pArgumentList.Name = "ArgumentList";
pArgumentList.ParameterType = typeof(object[]);
pArgumentList.Attributes.Add(new ParameterAttribute
{
ParameterSetName = "InvokeByStaticParameters",
Position = 3,
Mandatory = true
});
pArgumentList.Attributes.Add(new AllowNullAttribute());
dynamicParameters.Add("ArgumentList", pArgumentList);
return dynamicParameters;
}
开发者ID:FrankSiegemund,项目名称:azure-powershell,代码行数:41,代码来源:VirtualMachineVMImageDeleteMethod.cs
示例17: GetDynamicParameters
public object GetDynamicParameters()
{
if (_runtimeParamsDict == null)
{
ParameterAttribute paramAttribute = new ParameterAttribute();
paramAttribute.Mandatory = true;
string[] validNames = IndicatorAndStrategyContainer.Instance.Indicators.Select(indicator => indicator.Name).ToArray();
Collection<Attribute> nameAttributes = new Collection<Attribute>(new Attribute[] {
new ValidateSetAttribute(validNames),
new ValidateNotNullOrEmptyAttribute(),
paramAttribute
});
var nameParam = new RuntimeDefinedParameter("Name", typeof(string), nameAttributes);
_runtimeParamsDict = new RuntimeDefinedParameterDictionary();
_runtimeParamsDict.Add("Name", nameParam);
}
return _runtimeParamsDict;
}
开发者ID:quoctruong,项目名称:BackTestStock,代码行数:22,代码来源:NewIndicator.cs
示例18: CreateCacheMemoryDynamicParameter
private RuntimeDefinedParameter CreateCacheMemoryDynamicParameter(CacheServiceSkuType sku)
{
var parameter = new RuntimeDefinedParameter
{
Name = MemoryParameterName,
ParameterType = typeof(string),
};
// add the [parameter] attribute
var parameterAttribute = new ParameterAttribute
{
Mandatory = false,
};
parameter.Attributes.Add(parameterAttribute);
string[] values = (new CacheSkuCountConvert(sku)).GetValueList();
parameter.Attributes.Add(new ValidateSetAttribute(values)
{
IgnoreCase = true
});
return parameter;
}
开发者ID:djrosanova,项目名称:azure-sdk-tools,代码行数:24,代码来源:MemoryDynamicParameterSet.cs
示例19: GetDynamicParameters
public override object GetDynamicParameters()
{
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,
ValueFromPipelineByPropertyName = true,
ValueFromPipeline = false
});
pResourceGroupName.Attributes.Add(new AllowNullAttribute());
dynamicParameters.Add("ResourceGroupName", pResourceGroupName);
var pVMScaleSetName = new RuntimeDefinedParameter();
pVMScaleSetName.Name = "VMScaleSetName";
pVMScaleSetName.ParameterType = typeof(string);
pVMScaleSetName.Attributes.Add(new ParameterAttribute
{
ParameterSetName = "InvokeByDynamicParameters",
Position = 2,
Mandatory = true,
ValueFromPipelineByPropertyName = true,
ValueFromPipeline = false
});
pVMScaleSetName.Attributes.Add(new AliasAttribute("Name"));
pVMScaleSetName.Attributes.Add(new AllowNullAttribute());
dynamicParameters.Add("VMScaleSetName", pVMScaleSetName);
var pInstanceIds = new RuntimeDefinedParameter();
pInstanceIds.Name = "InstanceId";
pInstanceIds.ParameterType = typeof(string[]);
pInstanceIds.Attributes.Add(new ParameterAttribute
{
ParameterSetName = "InvokeByDynamicParameters",
Position = 3,
Mandatory = true,
ValueFromPipelineByPropertyName = true,
ValueFromPipeline = false
});
pInstanceIds.Attributes.Add(new AllowNullAttribute());
dynamicParameters.Add("InstanceId", pInstanceIds);
return dynamicParameters;
}
开发者ID:Azure,项目名称:azure-powershell,代码行数:48,代码来源:VirtualMachineScaleSetUpdateInstancesMethod.cs
示例20: 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("ErrorActionHtt
|
请发表评论