public static SoapAttribute GetCachedSoapAttribute (object reflectionObject) { lock (_soapAttributes.SyncRoot) { SoapAttribute att = _soapAttributes [reflectionObject] as SoapAttribute; if (att != null) return att; ICustomAttributeProvider ap = (ICustomAttributeProvider) reflectionObject; object[] atts = ap.GetCustomAttributes (typeof(SoapAttribute), true); if (atts.Length > 0) att = (SoapAttribute) atts[0]; else { if (reflectionObject is Type) att = new SoapTypeAttribute (); else if (reflectionObject is FieldInfo) att = new SoapFieldAttribute (); else if (reflectionObject is MethodBase) att = new SoapMethodAttribute (); else if (reflectionObject is ParameterInfo) att = new SoapParameterAttribute (); } att.SetReflectionObject (reflectionObject); _soapAttributes [reflectionObject] = att; return att; } }
// Token: 0x060055B2 RID: 21938 RVA: 0x0012F958 File Offset: 0x0012DB58 internal override SoapAttribute GetSoapAttributeNoLock() { object[] customAttributes = this.RI.GetCustomAttributes(typeof(SoapParameterAttribute), true); SoapAttribute soapAttribute; if (customAttributes != null && customAttributes.Length != 0) { soapAttribute = (SoapParameterAttribute)customAttributes[0]; } else { soapAttribute = new SoapParameterAttribute(); } soapAttribute.SetReflectInfo(this.RI); return(soapAttribute); }
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); }
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; }
} // 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
} // 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; } }