private MessagePartDescriptionCollection GetWrappedParts(MessagePartDescription bodyPart)
                {
                    System.Type type = bodyPart.Type;
                    MessagePartDescriptionCollection descriptions = new MessagePartDescriptionCollection();

                    foreach (MemberInfo info in type.GetMembers(BindingFlags.Public | BindingFlags.Instance))
                    {
                        if (((info.MemberType & (MemberTypes.Property | MemberTypes.Field)) != 0) && !info.IsDefined(typeof(SoapIgnoreAttribute), false))
                        {
                            MessagePartDescription description;
                            System.ServiceModel.Description.XmlName name = new System.ServiceModel.Description.XmlName(info.Name);
                            description = new MessagePartDescription(name.EncodedName, string.Empty)
                            {
                                AdditionalAttributesProvider = description.MemberInfo = info,
                                Index = description.SerializationPosition = descriptions.Count,
                                Type  = (info.MemberType == MemberTypes.Property) ? ((PropertyInfo)info).PropertyType : ((FieldInfo)info).FieldType
                            };
                            if (bodyPart.HasProtectionLevel)
                            {
                                description.ProtectionLevel = bodyPart.ProtectionLevel;
                            }
                            descriptions.Add(description);
                        }
                    }
                    return(descriptions);
                }
Exemple #2
0
 internal MessageBodyDescription(MessageBodyDescription other)
 {
     WrapperName      = other.WrapperName;
     WrapperNamespace = other.WrapperNamespace;
     Parts            = new MessagePartDescriptionCollection();
     foreach (MessagePartDescription mpd in other.Parts)
     {
         Parts.Add(mpd.Clone());
     }
     if (other.ReturnValue != null)
     {
         ReturnValue = other.ReturnValue.Clone();
     }
 }
        /// <summary>
        /// Adds an item to the collection.
        /// </summary>
        /// <param name="item">The object to add to the collection.</param>
        public void Add(HttpParameterDescription item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            if (this.IsSynchronized)
            {
                MessagePartDescription           mpd     = this.EnsureSynchronizedMessagePartDescription(item);
                MessagePartDescriptionCollection mpdColl = this.GetOrCreateMessagePartDescriptionCollection();
                mpdColl.Add(mpd);
            }
            else
            {
                this.innerCollection.Add(item);
            }
        }