Exemplo n.º 1
0
        /// <summary>
        /// Retrieves an object that defines the dynamic parameters of this cmdlet.
        /// </summary>
        /// <returns>An object that defines the dynamic parameters of this cmdlet.</returns>
        public object GetDynamicParameters()
        {
            if (dynamicParams == null)
            {
                dynamicParams = new DynamicParameterSet <ObjectProperty>(ParameterSet.Dynamic, e => BaseSetObjectPropertyParameters <ObjectProperty> .GetPropertyInfoViaTypeLookup(e));
            }

            return(dynamicParams.Parameters);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Retrieves an object that defines the dynamic parameters of this cmdlet.
        /// </summary>
        /// <returns>An object that defines the dynamic parameters of this cmdlet.</returns>
        public object GetDynamicParameters()
        {
            if (dynamicParams == null)
            {
                dynamicParams = new DynamicParameterSet <ChannelProperty>(new[] { ParameterSet.Dynamic, ParameterSet.DynamicManual }, e => BaseSetObjectPropertyParameters <ChannelProperty> .GetPropertyInfoViaPropertyParameter <Channel>(e));
            }

            return(dynamicParams.Parameters);
        }
Exemplo n.º 3
0
        internal object GetDynamicParameters(params string[] parameterSets)
        {
            if (parameterSets.Length == 0)
            {
                parameterSets = new[] { ParameterSet.Dynamic }
            }
            ;

            if (dynamicParameterSet == null)
            {
                var properties = ReflectionCacheManager.Get(typeof(TObject)).Properties.
                                 Where(p => p.GetAttribute <PropertyParameterAttribute>() != null).
                                 Select(p => Tuple.Create((Property)p.GetAttribute <PropertyParameterAttribute>().Property, p)).ToList();

                dynamicParameterSet = new DynamicParameterSet <Property>(
                    parameterSets,
                    e => ReflectionCacheManager.GetArrayPropertyInfo(properties.FirstOrDefault(p => p.Item1 == e)?.Item2.Property.PropertyType),
                    this
                    );
            }

            return(dynamicParameterSet.Parameters);
        }