/// <summary> Write a Return XML Element from attributes in a member. </summary> public virtual void WriteReturn(System.Xml.XmlWriter writer, System.Reflection.MemberInfo member, ReturnAttribute attribute, BaseAttribute parentAttribute, System.Type mappedClass) { writer.WriteStartElement( "return" ); // Attribute: <alias> if(attribute.Alias != null) writer.WriteAttributeString("alias", GetAttributeValue(attribute.Alias, mappedClass)); // Attribute: <entity-name> if(attribute.EntityName != null) writer.WriteAttributeString("entity-name", GetAttributeValue(attribute.EntityName, mappedClass)); // Attribute: <class> if(attribute.Class != null) writer.WriteAttributeString("class", GetAttributeValue(attribute.Class, mappedClass)); // Attribute: <lock-mode> if(attribute.LockMode != LockMode.Unspecified) writer.WriteAttributeString("lock-mode", GetXmlEnumValue(typeof(LockMode), attribute.LockMode)); WriteUserDefinedContent(writer, member, null, attribute); System.Collections.ArrayList memberAttribs = GetSortedAttributes(member); int attribPos; // Find the position of the ReturnAttribute (its <sub-element>s must be after it) for(attribPos=0; attribPos<memberAttribs.Count; attribPos++) if( memberAttribs[attribPos] is ReturnAttribute && ((BaseAttribute)memberAttribs[attribPos]).Position == attribute.Position ) break; // found int i = attribPos + 1; // Element: <return-discriminator> for(; i<memberAttribs.Count; i++) { BaseAttribute memberAttrib = memberAttribs[i] as BaseAttribute; if( IsNextElement(memberAttrib, parentAttribute, attribute.GetType()) || IsNextElement(memberAttrib, attribute, typeof(ReturnDiscriminatorAttribute)) ) break; // next attributes are 'elements' of the same level OR for 'sub-elements' else { if( memberAttrib is ReturnAttribute ) break; // Following attributes are for this Return if( memberAttrib is ReturnDiscriminatorAttribute ) WriteReturnDiscriminator(writer, member, memberAttrib as ReturnDiscriminatorAttribute, attribute, mappedClass); } } WriteUserDefinedContent(writer, member, typeof(ReturnDiscriminatorAttribute), attribute); // Element: <return-property> for(; i<memberAttribs.Count; i++) { BaseAttribute memberAttrib = memberAttribs[i] as BaseAttribute; if( IsNextElement(memberAttrib, parentAttribute, attribute.GetType()) || IsNextElement(memberAttrib, attribute, typeof(ReturnPropertyAttribute)) ) break; // next attributes are 'elements' of the same level OR for 'sub-elements' else { if( memberAttrib is ReturnAttribute ) break; // Following attributes are for this Return if( memberAttrib is ReturnPropertyAttribute ) WriteReturnProperty(writer, member, memberAttrib as ReturnPropertyAttribute, attribute, mappedClass); } } WriteUserDefinedContent(writer, member, typeof(ReturnPropertyAttribute), attribute); writer.WriteEndElement(); }
public void AddAssetsReturn(ReturnAttribute item) { _assetsReturnRep.Add(item); }