/// <summary>
        /// Walk from the parameter up to the containing type, looking for a
        /// <see cref="StorageAccountAttribute"/>. If found, return the account.
        /// </summary>
        internal static string GetAccountOverrideOrNull(ParameterInfo parameter)
        {
            if (parameter == null || 
                parameter.GetType() == typeof(AttributeBindingSource.FakeParameterInfo))
            {
                return null;
            }

            StorageAccountAttribute attribute = parameter.GetCustomAttribute<StorageAccountAttribute>();
            if (attribute != null)
            {
                return attribute.Account;
            }

            attribute = parameter.Member.GetCustomAttribute<StorageAccountAttribute>();
            if (attribute != null)
            {
                return attribute.Account;
            }

            attribute = parameter.Member.DeclaringType.GetCustomAttribute<StorageAccountAttribute>();
            if (attribute != null)
            {
                return attribute.Account;
            }

            return null;
        }
示例#2
0
 protected bool ParametersAreEqual(ParameterInfo parameter1, ParameterInfo parameter2)
 {
     return parameter1.Name == parameter2.Name
         && parameter1.Position == parameter2.Position
         && parameter1.GetType() == parameter2.GetType()
         && parameter1.IsOut == parameter2.IsOut
         && parameter1.IsOptional == parameter2.IsOptional;
 }
 internal static object GetDefaultParameterValue(ParameterInfo parameter)
 {
     if (!(parameter.GetType().Assembly == typeof(TypeReferences).Assembly) && parameter.Member.DeclaringType.Assembly.ReflectionOnly)
     {
         return parameter.RawDefaultValue;
     }
     return parameter.DefaultValue;
 }
 internal static bool IsDefined(ParameterInfo target, Type caType, bool inherit) {
   // JScript implements subclasses of ParameterInfo which throw an exception when Module is
   // accessed. We know that none of these are from a ReflectionOnly assembly.
   Type t = target.GetType();
   if (t.Assembly == typeof(CustomAttribute).Assembly || !target.Member.Module.Assembly.ReflectionOnly)
     return target.IsDefined(caType, inherit);
   return CustomAttribute.CheckForCustomAttribute(CustomAttributeData.GetCustomAttributes(target), caType);
 }
示例#5
0
 internal static Parameter FromParameterInfo(ParameterInfo parameterInfo)
 {
     return new Parameter(parameterInfo.GetType(), parameterInfo.ParameterType, parameterInfo.Name);
 }
示例#6
0
		protected override void AddParameterChildren (NodeInfoCollection c, NodeInfo parent, ParameterInfo param)
		{
			AddSubnodes (c, parent, param.GetType(), param);
		}
 internal static bool IsDefined(ParameterInfo target, Type caType, bool inherit)
 {
     if (!(target.GetType().Assembly == typeof(Microsoft.JScript.CustomAttribute).Assembly) && target.Member.Module.Assembly.ReflectionOnly)
     {
         return CheckForCustomAttribute(CustomAttributeData.GetCustomAttributes(target), caType);
     }
     return target.IsDefined(caType, inherit);
 }