Inheritance: System.Attribute
Esempio n. 1
0
        internal override SoapAttribute GetSoapAttributeNoLock()
        {
            object[]      customAttributes = this.RI.GetCustomAttributes(typeof(SoapFieldAttribute), false);
            SoapAttribute soapAttribute    = customAttributes == null || customAttributes.Length == 0 ? (SoapAttribute) new SoapFieldAttribute() : (SoapAttribute)customAttributes[0];

            soapAttribute.SetReflectInfo((object)this.RI);
            return(soapAttribute);
        }
        private SoapAttribute _soapAttr = null; // Soap related attributes derive from SoapAttribute

        // Retrieve SOAP attribute info for _mi (or create for caching if not specified)
        internal SoapAttribute GetSoapAttribute()
        {
            if (_soapAttr == null)
            {
                lock (this)
                {
                    if (_soapAttr == null)
                    {
                        _soapAttr = GetSoapAttributeNoLock();
                    } // if (_soapAttr == null)
                }     // lock (this)
            }

            return(_soapAttr);
        } // GetSoapAttribute
        private SoapAttribute _soapAttr = null; // Soap related attributes derive from SoapAttribute

        // Retrieve SOAP attribute info for _mi (or create for caching if not specified)
        internal SoapAttribute GetSoapAttribute()
        {
            if (_soapAttr == null)
            {
                lock (this)
                {
                    if (_soapAttr == null)
                    {
                        _soapAttr = GetSoapAttributeNoLock();
                    } // if (_soapAttr == null)
                } // lock (this)
            }

            return _soapAttr;
        } // GetSoapAttribute
        internal override SoapAttribute GetSoapAttributeNoLock()
        {
            SoapAttribute tempSoapAttr = null;

            Object[] attrs = RI.GetCustomAttributes(typeof(SoapParameterAttribute), true);
            if ((attrs != null) && (attrs.Length != 0))
            {
                tempSoapAttr = (SoapParameterAttribute)attrs[0];
            }
            else
            {
                tempSoapAttr = new SoapParameterAttribute();
            }

            // IMPORTANT: This has to be done for certain values to be automatically
            //   generated in the attribute.
            tempSoapAttr.SetReflectInfo(RI);

            return(tempSoapAttr);
        }
 internal SoapAttribute GetSoapAttribute()
 {
     if (this._soapAttr == null)
     {
         lock (this)
         {
             if (this._soapAttr == null)
             {
                 SoapAttribute            attribute = null;
                 ICustomAttributeProvider rI        = (ICustomAttributeProvider)this.RI;
                 if (this.RI is Type)
                 {
                     object[] customAttributes = rI.GetCustomAttributes(typeof(SoapTypeAttribute), true);
                     if ((customAttributes != null) && (customAttributes.Length != 0))
                     {
                         attribute = (SoapAttribute)customAttributes[0];
                     }
                     else
                     {
                         attribute = new SoapTypeAttribute();
                     }
                 }
                 else if (this.RI is MethodBase)
                 {
                     object[] objArray2 = rI.GetCustomAttributes(typeof(SoapMethodAttribute), true);
                     if ((objArray2 != null) && (objArray2.Length != 0))
                     {
                         attribute = (SoapAttribute)objArray2[0];
                     }
                     else
                     {
                         attribute = new SoapMethodAttribute();
                     }
                 }
                 else if (this.RI is FieldInfo)
                 {
                     object[] objArray3 = rI.GetCustomAttributes(typeof(SoapFieldAttribute), false);
                     if ((objArray3 != null) && (objArray3.Length != 0))
                     {
                         attribute = (SoapAttribute)objArray3[0];
                     }
                     else
                     {
                         attribute = new SoapFieldAttribute();
                     }
                 }
                 else if (this.RI is ParameterInfo)
                 {
                     object[] objArray4 = rI.GetCustomAttributes(typeof(SoapParameterAttribute), true);
                     if ((objArray4 != null) && (objArray4.Length != 0))
                     {
                         attribute = (SoapParameterAttribute)objArray4[0];
                     }
                     else
                     {
                         attribute = new SoapParameterAttribute();
                     }
                 }
                 attribute.SetReflectInfo(this.RI);
                 this._soapAttr = attribute;
             }
         }
     }
     return(this._soapAttr);
 }
        } // RemotingCachedData


        // Retrieve SOAP attribute info for _mi (or create for caching if not specified)
        internal SoapAttribute GetSoapAttribute()
        {
            if (_soapAttr == null)
            {
                lock (this)
                {
                    if (_soapAttr == null)
                    {
                        SoapAttribute tempSoapAttr = null;
                    
                        ICustomAttributeProvider cap = (ICustomAttributeProvider)RI;
                        
                        if (RI is Type)
                        {
                            Object[] attrs = cap.GetCustomAttributes(typeof(SoapTypeAttribute), true);
                            if ((attrs != null) && (attrs.Length != 0))
                                tempSoapAttr = (SoapAttribute)attrs[0];
                            else
                                tempSoapAttr = new SoapTypeAttribute();
                        }
                        else
                        if (RI is MethodBase)
                        {
                            Object[] attrs = cap.GetCustomAttributes(typeof(SoapMethodAttribute), true);
                            if ((attrs != null) && (attrs.Length != 0))
                                tempSoapAttr = (SoapAttribute)attrs[0];
                            else
                                tempSoapAttr = new SoapMethodAttribute();
                        }
                        else
                        if (RI is FieldInfo)
                        {
                            Object[] attrs = cap.GetCustomAttributes(typeof(SoapFieldAttribute), false);
                            if ((attrs != null) && (attrs.Length != 0))
                                tempSoapAttr = (SoapAttribute)attrs[0];
                            else
                                tempSoapAttr = new SoapFieldAttribute();
                        }
                        else
                        if (RI is ParameterInfo)
                        {
                            Object[] attrs = cap.GetCustomAttributes(typeof(SoapParameterAttribute), true);
                            if ((attrs != null) && (attrs.Length != 0))
                                tempSoapAttr = (SoapParameterAttribute)attrs[0];
                            else
                                tempSoapAttr = new SoapParameterAttribute();
                        }

                        // IMPORTANT: This has to be done for certain values to be automatically
                        //   generated in the attribute.
                        tempSoapAttr.SetReflectInfo(RI);

                        _soapAttr = tempSoapAttr;
                    } // if (_soapAttr == null)
                } // lock (this)
            }
            
            return _soapAttr;
        } // GetSoapAttribute
Esempio n. 7
0
        } // RemotingCachedData

        // Retrieve SOAP attribute info for _mi (or create for caching if not specified)
        internal SoapAttribute GetSoapAttribute()
        {
            if (_soapAttr == null)
            {
                lock (this)
                {
                    if (_soapAttr == null)
                    {
                        SoapAttribute tempSoapAttr = null;

                        ICustomAttributeProvider cap = (ICustomAttributeProvider)RI;

                        if (RI is Type)
                        {
                            Object[] attrs = cap.GetCustomAttributes(typeof(SoapTypeAttribute), true);
                            if ((attrs != null) && (attrs.Length != 0))
                            {
                                tempSoapAttr = (SoapAttribute)attrs[0];
                            }
                            else
                            {
                                tempSoapAttr = new SoapTypeAttribute();
                            }
                        }
                        else
                        if (RI is MethodBase)
                        {
                            Object[] attrs = cap.GetCustomAttributes(typeof(SoapMethodAttribute), true);
                            if ((attrs != null) && (attrs.Length != 0))
                            {
                                tempSoapAttr = (SoapAttribute)attrs[0];
                            }
                            else
                            {
                                tempSoapAttr = new SoapMethodAttribute();
                            }
                        }
                        else
                        if (RI is FieldInfo)
                        {
                            Object[] attrs = cap.GetCustomAttributes(typeof(SoapFieldAttribute), false);
                            if ((attrs != null) && (attrs.Length != 0))
                            {
                                tempSoapAttr = (SoapAttribute)attrs[0];
                            }
                            else
                            {
                                tempSoapAttr = new SoapFieldAttribute();
                            }
                        }
                        else
                        if (RI is ParameterInfo)
                        {
                            Object[] attrs = cap.GetCustomAttributes(typeof(SoapParameterAttribute), true);
                            if ((attrs != null) && (attrs.Length != 0))
                            {
                                tempSoapAttr = (SoapParameterAttribute)attrs[0];
                            }
                            else
                            {
                                tempSoapAttr = new SoapParameterAttribute();
                            }
                        }

                        // IMPORTANT: This has to be done for certain values to be automatically
                        //   generated in the attribute.
                        tempSoapAttr.SetReflectInfo(RI);

                        _soapAttr = tempSoapAttr;
                    } // if (_soapAttr == null)
                }     // lock (this)
            }

            return(_soapAttr);
        } // GetSoapAttribute
 internal SoapAttribute GetSoapAttribute()
 {
     if (this._soapAttr == null)
     {
         lock (this)
         {
             if (this._soapAttr == null)
             {
                 SoapAttribute attribute = null;
                 ICustomAttributeProvider rI = (ICustomAttributeProvider) this.RI;
                 if (this.RI is Type)
                 {
                     object[] customAttributes = rI.GetCustomAttributes(typeof(SoapTypeAttribute), true);
                     if ((customAttributes != null) && (customAttributes.Length != 0))
                     {
                         attribute = (SoapAttribute) customAttributes[0];
                     }
                     else
                     {
                         attribute = new SoapTypeAttribute();
                     }
                 }
                 else if (this.RI is MethodBase)
                 {
                     object[] objArray2 = rI.GetCustomAttributes(typeof(SoapMethodAttribute), true);
                     if ((objArray2 != null) && (objArray2.Length != 0))
                     {
                         attribute = (SoapAttribute) objArray2[0];
                     }
                     else
                     {
                         attribute = new SoapMethodAttribute();
                     }
                 }
                 else if (this.RI is FieldInfo)
                 {
                     object[] objArray3 = rI.GetCustomAttributes(typeof(SoapFieldAttribute), false);
                     if ((objArray3 != null) && (objArray3.Length != 0))
                     {
                         attribute = (SoapAttribute) objArray3[0];
                     }
                     else
                     {
                         attribute = new SoapFieldAttribute();
                     }
                 }
                 else if (this.RI is ParameterInfo)
                 {
                     object[] objArray4 = rI.GetCustomAttributes(typeof(SoapParameterAttribute), true);
                     if ((objArray4 != null) && (objArray4.Length != 0))
                     {
                         attribute = (SoapParameterAttribute) objArray4[0];
                     }
                     else
                     {
                         attribute = new SoapParameterAttribute();
                     }
                 }
                 attribute.SetReflectInfo(this.RI);
                 this._soapAttr = attribute;
             }
         }
     }
     return this._soapAttr;
 }
	// Get the cached SOAP attribute data for an object.
	public static SoapAttribute GetCachedSoapAttribute(Object reflectionObject)
			{
				// Validate the paramter to ensure that it is a
				// legitimate reflection object.
				if(reflectionObject == null)
				{
					return null;
				}
				else if(!(reflectionObject is MemberInfo) &&
						!(reflectionObject is ParameterInfo))
				{
					return null;
				}
				lock(typeof(InternalRemotingServices))
				{
					Object attr;
					Object[] attrs;

					// Look for a cached value from last time.
					if(attributeHash == null)
					{
						attributeHash = new Hashtable();
					}
					else if((attr = attributeHash[reflectionObject]) != null)
					{
						return (attr as SoapAttribute);
					}

					// Get the attribute information from the type.
					if(reflectionObject is Type)
					{
						attrs = ((Type)reflectionObject).GetCustomAttributes
							(typeof(SoapTypeAttribute), true);
						if(attrs == null || attrs.Length < 1)
						{
							attr = new SoapTypeAttribute();
						}
						else
						{
							attr = attrs[0];
						}
					}
					else if(reflectionObject is MethodBase)
					{
						attrs = ((MethodBase)reflectionObject)
							.GetCustomAttributes
								(typeof(SoapMethodAttribute), true);
						if(attrs == null || attrs.Length < 1)
						{
							attr = new SoapMethodAttribute();
						}
						else
						{
							attr = attrs[0];
						}
					}
					else if(reflectionObject is FieldInfo)
					{
						attrs = ((FieldInfo)reflectionObject)
							.GetCustomAttributes
								(typeof(SoapFieldAttribute), true);
						if(attrs == null || attrs.Length < 1)
						{
							attr = new SoapFieldAttribute();
						}
						else
						{
							attr = attrs[0];
						}
					}
					else if(reflectionObject is ParameterInfo)
					{
						attrs = ((ParameterInfo)reflectionObject)
							.GetCustomAttributes
								(typeof(SoapParameterAttribute), true);
						if(attrs == null || attrs.Length < 1)
						{
							attr = new SoapParameterAttribute();
						}
						else
						{
							attr = attrs[0];
						}
					}
					else
					{
						attrs = ((MemberInfo)reflectionObject)
							.GetCustomAttributes(typeof(SoapAttribute), true);
						if(attrs == null || attrs.Length < 1)
						{
							attr = new SoapAttribute();
						}
						else
						{
							attr = attrs[0];
						}
					}
					((SoapAttribute)attr).SetReflectInfo(reflectionObject);
					return (SoapAttribute)attr;
				}
			}