private Association Read16_Association(bool isNullable, bool checkType) { XmlQualifiedName type = checkType ? base.GetXsiType() : null; bool flag = false; if (isNullable) { flag = base.ReadNull(); } if ((checkType && (type != null)) && ((type.Name != this.id9_Association) || (type.Namespace != this.id2_Item))) { throw base.CreateUnknownTypeException(type); } if (flag) { return null; } Association o = new Association(); bool[] flagArray = new bool[4]; while (base.Reader.MoveToNextAttribute()) { if ((!flagArray[1] && (base.Reader.LocalName == this.id9_Association)) && (base.Reader.NamespaceURI == this.id4_Item)) { o.Association1 = base.Reader.Value; flagArray[1] = true; } else { if ((!flagArray[2] && (base.Reader.LocalName == this.id98_SourceRole)) && (base.Reader.NamespaceURI == this.id4_Item)) { o.SourceRole = base.Reader.Value; flagArray[2] = true; continue; } if ((!flagArray[3] && (base.Reader.LocalName == this.id99_ResultRole)) && (base.Reader.NamespaceURI == this.id4_Item)) { o.ResultRole = base.Reader.Value; flagArray[3] = true; continue; } if (!base.IsXmlnsAttribute(base.Reader.Name)) { base.UnknownNode(o, ":Association, :SourceRole, :ResultRole"); } } } base.Reader.MoveToElement(); if (base.Reader.IsEmptyElement) { base.Reader.Skip(); return o; } base.Reader.ReadStartElement(); base.Reader.MoveToContent(); int whileIterations = 0; int readerCount = base.ReaderCount; while ((base.Reader.NodeType != XmlNodeType.EndElement) && (base.Reader.NodeType != XmlNodeType.None)) { if (base.Reader.NodeType == XmlNodeType.Element) { if ((!flagArray[0] && (base.Reader.LocalName == this.id100_AssociatedInstance)) && (base.Reader.NamespaceURI == this.id2_Item)) { o.AssociatedInstance = this.Read15_AssociationAssociatedInstance(false, true); flagArray[0] = true; } else { base.UnknownNode(o, "http://schemas.microsoft.com/cmdlets-over-objects/2009/11:AssociatedInstance"); } } else { base.UnknownNode(o, "http://schemas.microsoft.com/cmdlets-over-objects/2009/11:AssociatedInstance"); } base.Reader.MoveToContent(); base.CheckReaderCount(ref whileIterations, ref readerCount); } base.ReadEndElement(); return o; }
private ParameterMetadata GenerateAssociationClause(IEnumerable<string> commonParameterSets, IEnumerable<string> queryParameterSets, IEnumerable<string> methodParameterSets, Association associationMetadata, AssociationAssociatedInstance associatedInstanceMetadata, TextWriter output) { ParameterMetadata cmdletParameterMetadata = this.GetParameter(queryParameterSets, associationMetadata.SourceRole, associatedInstanceMetadata.Type, associatedInstanceMetadata.CmdletParameterMetadata); cmdletParameterMetadata.Attributes.Add(new ValidateNotNullAttribute()); this.GenerateIfBoundParameter(commonParameterSets, methodParameterSets, cmdletParameterMetadata, output); output.WriteLine(" $__cmdletization_queryBuilder.FilterByAssociatedInstance(${{{0}}}, '{1}', '{2}', '{3}', '{4}')", new object[] { CommandMetadata.EscapeVariableName(cmdletParameterMetadata.Name), CommandMetadata.EscapeSingleQuotedString(associationMetadata.Association1), CommandMetadata.EscapeSingleQuotedString(associationMetadata.SourceRole), CommandMetadata.EscapeSingleQuotedString(associationMetadata.ResultRole), GetBehaviorWhenNoMatchesFound(associatedInstanceMetadata.CmdletParameterMetadata) }); output.WriteLine(" }"); return cmdletParameterMetadata; }
private void Write16_Association(string n, string ns, Association o, bool isNullable, bool needType) { if (o == null) { if (isNullable) { base.WriteNullTagLiteral(n, ns); } } else { if (!needType && !(o.GetType() == typeof(Association))) { throw base.CreateUnknownTypeException(o); } base.WriteStartElement(n, ns, o, false, null); if (needType) { base.WriteXsiType("Association", "http://schemas.microsoft.com/cmdlets-over-objects/2009/11"); } base.WriteAttribute("Association", "", o.Association1); base.WriteAttribute("SourceRole", "", o.SourceRole); base.WriteAttribute("ResultRole", "", o.ResultRole); this.Write15_AssociationAssociatedInstance("AssociatedInstance", "http://schemas.microsoft.com/cmdlets-over-objects/2009/11", o.AssociatedInstance, false, false); base.WriteEndElement(o); } }