private QueryOption Read17_QueryOption(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.id19_QueryOption) || (type.Namespace != this.id2_Item))) { throw base.CreateUnknownTypeException(type); } if (flag) { return null; } QueryOption o = new QueryOption(); bool[] flagArray = new bool[3]; while (base.Reader.MoveToNextAttribute()) { if ((!flagArray[2] && (base.Reader.LocalName == this.id97_OptionName)) && (base.Reader.NamespaceURI == this.id4_Item)) { o.OptionName = base.Reader.Value; flagArray[2] = true; } else if (!base.IsXmlnsAttribute(base.Reader.Name)) { base.UnknownNode(o, ":OptionName"); } } 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.id89_Type)) && (base.Reader.NamespaceURI == this.id2_Item)) { o.Type = this.Read2_TypeMetadata(false, true); flagArray[0] = true; } else if ((!flagArray[1] && (base.Reader.LocalName == this.id11_CmdletParameterMetadata)) && (base.Reader.NamespaceURI == this.id2_Item)) { o.CmdletParameterMetadata = this.Read10_Item(false, true); flagArray[1] = true; } else { base.UnknownNode(o, "http://schemas.microsoft.com/cmdlets-over-objects/2009/11:Type, http://schemas.microsoft.com/cmdlets-over-objects/2009/11:CmdletParameterMetadata"); } } else { base.UnknownNode(o, "http://schemas.microsoft.com/cmdlets-over-objects/2009/11:Type, http://schemas.microsoft.com/cmdlets-over-objects/2009/11:CmdletParameterMetadata"); } base.Reader.MoveToContent(); base.CheckReaderCount(ref whileIterations, ref readerCount); } base.ReadEndElement(); return o; }
private ParameterMetadata GenerateOptionClause(IEnumerable<string> commonParameterSets, IEnumerable<string> queryParameterSets, IEnumerable<string> methodParameterSets, QueryOption queryOptionMetadata, TextWriter output) { ParameterMetadata cmdletParameterMetadata = this.GetParameter(queryParameterSets, queryOptionMetadata.OptionName, queryOptionMetadata.Type, queryOptionMetadata.CmdletParameterMetadata); this.GenerateIfBoundParameter(commonParameterSets, methodParameterSets, cmdletParameterMetadata, output); output.WriteLine(" $__cmdletization_queryBuilder.AddQueryOption('{0}', ${{{1}}})", CommandMetadata.EscapeSingleQuotedString(queryOptionMetadata.OptionName), CommandMetadata.EscapeVariableName(cmdletParameterMetadata.Name)); output.WriteLine(" }"); return cmdletParameterMetadata; }
private void Write17_QueryOption(string n, string ns, QueryOption o, bool isNullable, bool needType) { if (o == null) { if (isNullable) { base.WriteNullTagLiteral(n, ns); } } else { if (!needType && !(o.GetType() == typeof(QueryOption))) { throw base.CreateUnknownTypeException(o); } base.WriteStartElement(n, ns, o, false, null); if (needType) { base.WriteXsiType("QueryOption", "http://schemas.microsoft.com/cmdlets-over-objects/2009/11"); } base.WriteAttribute("OptionName", "", o.OptionName); this.Write2_TypeMetadata("Type", "http://schemas.microsoft.com/cmdlets-over-objects/2009/11", o.Type, false, false); this.Write10_Item("CmdletParameterMetadata", "http://schemas.microsoft.com/cmdlets-over-objects/2009/11", o.CmdletParameterMetadata, false, false); base.WriteEndElement(o); } }