/// <summary> Write a Any XML Element from attributes in a member. </summary> public virtual void WriteAny(System.Xml.XmlWriter writer, System.Reflection.MemberInfo member, AnyAttribute attribute, BaseAttribute parentAttribute, System.Type mappedClass) { writer.WriteStartElement( "any" ); // Attribute: <column> if(attribute.Column != null) writer.WriteAttributeString("column", GetAttributeValue(attribute.Column, mappedClass)); // Attribute: <id-type> writer.WriteAttributeString("id-type", attribute.IdType==null ? DefaultHelper.Get_Any_IdType_DefaultValue(member) : GetAttributeValue(attribute.IdType, mappedClass)); // Attribute: <meta-type> if(attribute.MetaType != null) writer.WriteAttributeString("meta-type", GetAttributeValue(attribute.MetaType, mappedClass)); // Attribute: <name> writer.WriteAttributeString("name", attribute.Name==null ? DefaultHelper.Get_Any_Name_DefaultValue(member) : GetAttributeValue(attribute.Name, mappedClass)); // Attribute: <access> if(attribute.Access != null) writer.WriteAttributeString("access", GetAttributeValue(attribute.Access, mappedClass)); // Attribute: <insert> if( attribute.InsertSpecified ) writer.WriteAttributeString("insert", attribute.Insert ? "true" : "false"); // Attribute: <update> if( attribute.UpdateSpecified ) writer.WriteAttributeString("update", attribute.Update ? "true" : "false"); // Attribute: <cascade> if(attribute.Cascade != null) writer.WriteAttributeString("cascade", GetAttributeValue(attribute.Cascade, mappedClass)); // Attribute: <index> if(attribute.Index != null) writer.WriteAttributeString("index", GetAttributeValue(attribute.Index, mappedClass)); // Attribute: <optimistic-lock> if( attribute.OptimisticLockSpecified ) writer.WriteAttributeString("optimistic-lock", attribute.OptimisticLock ? "true" : "false"); // Attribute: <lazy> if( attribute.LazySpecified ) writer.WriteAttributeString("lazy", attribute.Lazy ? "true" : "false"); // Attribute: <node> if(attribute.Node != null) writer.WriteAttributeString("node", GetAttributeValue(attribute.Node, mappedClass)); WriteUserDefinedContent(writer, member, null, attribute); System.Collections.ArrayList memberAttribs = GetSortedAttributes(member); int attribPos; // Find the position of the AnyAttribute (its <sub-element>s must be after it) for(attribPos=0; attribPos<memberAttribs.Count; attribPos++) if( memberAttribs[attribPos] is AnyAttribute && ((BaseAttribute)memberAttribs[attribPos]).Position == attribute.Position ) break; // found int i = attribPos + 1; // Element: <meta> for(; i<memberAttribs.Count; i++) { BaseAttribute memberAttrib = memberAttribs[i] as BaseAttribute; if( IsNextElement(memberAttrib, parentAttribute, attribute.GetType()) || IsNextElement(memberAttrib, attribute, typeof(MetaAttribute)) ) break; // next attributes are 'elements' of the same level OR for 'sub-elements' else { if( memberAttrib is AnyAttribute ) break; // Following attributes are for this Any if( memberAttrib is MetaAttribute ) WriteMeta(writer, member, memberAttrib as MetaAttribute, attribute, mappedClass); } } WriteUserDefinedContent(writer, member, typeof(MetaAttribute), attribute); // Element: <meta-value> for(; i<memberAttribs.Count; i++) { BaseAttribute memberAttrib = memberAttribs[i] as BaseAttribute; if( IsNextElement(memberAttrib, parentAttribute, attribute.GetType()) || IsNextElement(memberAttrib, attribute, typeof(MetaValueAttribute)) ) break; // next attributes are 'elements' of the same level OR for 'sub-elements' else { if( memberAttrib is AnyAttribute ) break; // Following attributes are for this Any if( memberAttrib is MetaValueAttribute ) WriteMetaValue(writer, member, memberAttrib as MetaValueAttribute, attribute, mappedClass); } } WriteUserDefinedContent(writer, member, typeof(MetaValueAttribute), attribute); // Element: <column> for(; i<memberAttribs.Count; i++) { BaseAttribute memberAttrib = memberAttribs[i] as BaseAttribute; if( IsNextElement(memberAttrib, parentAttribute, attribute.GetType()) || IsNextElement(memberAttrib, attribute, typeof(ColumnAttribute)) ) break; // next attributes are 'elements' of the same level OR for 'sub-elements' else { if( memberAttrib is AnyAttribute ) break; // Following attributes are for this Any if( memberAttrib is ColumnAttribute ) WriteColumn(writer, member, memberAttrib as ColumnAttribute, attribute, mappedClass); } } WriteUserDefinedContent(writer, member, typeof(ColumnAttribute), attribute); writer.WriteEndElement(); }