示例#1
0
        private AssociationBridge CreateCollectionRelationshipBridge(Relationship relationship, RelationshipSorter sorter, Interaction
                                                                     interaction)
        {
            RelationshipSorter association = sorter.GetAsRelationshipSorter(relationship);
            List <PartBridge>  list        = new List <PartBridge>();
            int length = association.GetSingleCollapsedPropertySize();

            for (int i = 0; i < length; i++)
            {
                list.Add(CreatePartBridge(association, interaction, GetMessagePart(interaction, relationship, null), new BridgeContext(true
                                                                                                                                       , i), false));
            }
            // bug 13240 - if empty collection and pop/mand, add a placeholder bridge - this will output a nullflavor element, and a warning for mandatory
            if (list.IsEmpty() && (ConformanceLevelUtil.IsPopulated(relationship) || ConformanceLevelUtil.IsMandatory(relationship)))
            {
                list.Add(CreatePartBridgeFromBean(string.Empty, null, interaction, GetMessagePart(interaction, relationship, null)));
            }
            return(new AssociationBridgeImpl(relationship, list));
        }