From: Daniel C. \(kzu\) <dca...@us...> - 2005-10-31 12:28:33
|
Update of /cvsroot/mvp-xml/Design/v2/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32177/v2/tests Modified Files: CustomerSchema.Serialization.cs Mvp.Xml.Design.Tests.csproj Log Message: Updated for multiple types. Index: CustomerSchema.Serialization.cs =================================================================== RCS file: /cvsroot/mvp-xml/Design/v2/tests/CustomerSchema.Serialization.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- CustomerSchema.Serialization.cs 31 Oct 2005 11:49:18 -0000 1.2 +++ CustomerSchema.Serialization.cs 31 Oct 2005 12:28:17 -0000 1.3 @@ -402,4 +402,307 @@ } +#pragma warning restore 0642, 0219//------------------------------------------------------------------------------ +// <autogenerated> +// This code was generated by the Mvp.Xml.XGen tool. +// Tool Version: 1.1.1.0 +// Runtime Version: 2.0.50727.42 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </autogenerated> +//------------------------------------------------------------------------------ + +#pragma warning disable 0642, 0219 +namespace CustomerSchemaSerialization +{ + using System.Xml.Serialization; + using System; + + + /// /// <summary>Custom reader for CustomerSchemaOrders instances.</summary> + internal class CustomerSchemaOrdersReader : CustomerSchemaOrdersSerializer.BaseReader + { + + + /// <remarks/> + protected override global::Mvp.Xml.Design.Tests.CustomerSchemaOrders Read2_CustomerSchemaOrders(bool isNullable, bool checkType) + { + global::Mvp.Xml.Design.Tests.CustomerSchemaOrders obj = base.Read2_CustomerSchemaOrders(isNullable, checkType); + CustomerSchemaOrdersDeserializedHandler handler = CustomerSchemaOrdersDeserialized; + if (handler != null) + handler(obj); + + return obj; + } + + /// <summary>Reads an object of type Mvp.Xml.Design.Tests.CustomerSchemaOrders.</summary> + internal Mvp.Xml.Design.Tests.CustomerSchemaOrders Read() + { + return (Mvp.Xml.Design.Tests.CustomerSchemaOrders) Read3_CustomerSchemaOrders(); + } + + /// /// <remarks/> + public event CustomerSchemaOrdersDeserializedHandler CustomerSchemaOrdersDeserialized; + } + + /// /// <summary>Custom writer for CustomerSchemaOrders instances.</summary> + internal class CustomerSchemaOrdersWriter : CustomerSchemaOrdersSerializer.BaseWriter + { + + + /// <summary>Writes an object of type Mvp.Xml.Design.Tests.CustomerSchemaOrders.</summary> + internal void Write(Mvp.Xml.Design.Tests.CustomerSchemaOrders value) + { + Write3_CustomerSchemaOrders(value); + } + } +} +#if _DYNAMIC_XMLSERIALIZER_COMPILATION +[assembly:System.Security.AllowPartiallyTrustedCallers()] +[assembly:System.Security.SecurityTransparent()] +#endif + +namespace CustomerSchemaSerialization { + + internal partial class CustomerSchemaOrdersSerializer { + internal class BaseWriter : System.Xml.Serialization.XmlSerializationWriter { + + protected internal void Write3_CustomerSchemaOrders(object o) { + WriteStartDocument(); + if (o == null) { + WriteNullTagLiteral(@"CustomerSchemaOrders", @""); + return; + } + TopLevelElement(); + Write2_CustomerSchemaOrders(@"CustomerSchemaOrders", @"", ((global::Mvp.Xml.Design.Tests.CustomerSchemaOrders)o), true, false); + } + + void Write2_CustomerSchemaOrders(string n, string ns, global::Mvp.Xml.Design.Tests.CustomerSchemaOrders o, bool isNullable, bool needType) { + if ((object)o == null) { + if (isNullable) WriteNullTagLiteral(n, ns); + return; + } + if (!needType) { + System.Type t = o.GetType(); + if (t == typeof(global::Mvp.Xml.Design.Tests.CustomerSchemaOrders)) { + } + else { + throw CreateUnknownTypeException(o); + } + } + WriteStartElement(n, ns, o, false, null); + if (needType) WriteXsiType(null, @""); + WriteElementStringRaw(@"Date", @"", FromDateTime(((global::System.DateTime)o.@Date))); + WriteEndElement(o); + } + + protected override void InitCallbacks() { + } + } + } + + internal partial class CustomerSchemaOrdersSerializer { + internal class BaseReader : System.Xml.Serialization.XmlSerializationReader { + + protected internal object Read3_CustomerSchemaOrders() { + object o = null; + Reader.MoveToContent(); + if (Reader.NodeType == System.Xml.XmlNodeType.Element) { + if (((object) Reader.LocalName == (object)id1_CustomerSchemaOrders && (object) Reader.NamespaceURI == (object)id2_Item)) { + o = Read2_CustomerSchemaOrders(true, true); + } + else { + throw CreateUnknownNodeException(); + } + } + else { + UnknownNode(null, @":CustomerSchemaOrders"); + } + return (object)o; + } + + /// <remarks/> + protected virtual global::Mvp.Xml.Design.Tests.CustomerSchemaOrders Read2_CustomerSchemaOrders(bool isNullable, bool checkType) { + System.Xml.XmlQualifiedName xsiType = checkType ? GetXsiType() : null; + bool isNull = false; + if (isNullable) isNull = ReadNull(); + if (checkType) { + if (xsiType == null || ((object) ((System.Xml.XmlQualifiedName)xsiType).Name == (object)id2_Item && (object) ((System.Xml.XmlQualifiedName)xsiType).Namespace == (object)id2_Item)) { + } + else + throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)xsiType); + } + if (isNull) return null; + global::Mvp.Xml.Design.Tests.CustomerSchemaOrders o; + o = new global::Mvp.Xml.Design.Tests.CustomerSchemaOrders(); + bool[] paramsRead = new bool[1]; + while (Reader.MoveToNextAttribute()) { + if (!IsXmlnsAttribute(Reader.Name)) { + UnknownNode((object)o); + } + } + Reader.MoveToElement(); + if (Reader.IsEmptyElement) { + Reader.Skip(); + return o; + } + Reader.ReadStartElement(); + Reader.MoveToContent(); + int whileIterations0 = 0; + int readerCount0 = ReaderCount; + while (Reader.NodeType != System.Xml.XmlNodeType.EndElement && Reader.NodeType != System.Xml.XmlNodeType.None) { + if (Reader.NodeType == System.Xml.XmlNodeType.Element) { + if (!paramsRead[0] && ((object) Reader.LocalName == (object)id3_Date && (object) Reader.NamespaceURI == (object)id2_Item)) { + { + o.@Date = ToDateTime(Reader.ReadElementString()); + } + paramsRead[0] = true; + } + else { + UnknownNode((object)o, @":Date"); + } + } + else { + UnknownNode((object)o, @":Date"); + } + Reader.MoveToContent(); + CheckReaderCount(ref whileIterations0, ref readerCount0); + } + ReadEndElement(); + return o; + } + + protected override void InitCallbacks() { + } + + string id1_CustomerSchemaOrders; + string id3_Date; + string id2_Item; + + protected override void InitIDs() { + id1_CustomerSchemaOrders = Reader.NameTable.Add(@"CustomerSchemaOrders"); + id3_Date = Reader.NameTable.Add(@"Date"); + id2_Item = Reader.NameTable.Add(@""); + } + } + } + + internal abstract class CustomerSchemaOrdersSerializerBase : System.Xml.Serialization.XmlSerializer { + protected override System.Xml.Serialization.XmlSerializationReader CreateReader() { + return new CustomerSchemaOrdersSerializer.BaseReader(); + } + protected override System.Xml.Serialization.XmlSerializationWriter CreateWriter() { + return new CustomerSchemaOrdersSerializer.BaseWriter(); + } + } + + internal sealed partial class CustomerSchemaOrdersSerializer : CustomerSchemaOrdersSerializerBase { + + CustomerSchemaOrdersReader _reader; + CustomerSchemaOrdersWriter _writer; + + /// <summary>Constructs the serializer.</summary> + public CustomerSchemaOrdersSerializer() + { + } + + /// <summary>Constructs the serializer with a pre-built reader.</summary> + public CustomerSchemaOrdersSerializer(CustomerSchemaOrdersReader reader) + { + _reader = reader; + } + + /// <summary>Constructs the serializer with a pre-built writer.</summary> + public CustomerSchemaOrdersSerializer(CustomerSchemaOrdersWriter writer) + { + _writer = writer; + } + + /// <summary>Constructs the serializer with pre-built reader and writer.</summary> + public CustomerSchemaOrdersSerializer(CustomerSchemaOrdersReader reader, CustomerSchemaOrdersWriter writer) + { + _reader = reader; + _writer = writer; + } + + /// <remarks/> + protected override System.Xml.Serialization.XmlSerializationReader CreateReader() + { + if (_reader != null) return _reader; + + return base.CreateReader(); + } + + /// <remarks/> + protected override System.Xml.Serialization.XmlSerializationWriter CreateWriter() + { + if (_writer != null) return _writer; + + return base.CreateWriter(); + } + + public override System.Boolean CanDeserialize(System.Xml.XmlReader xmlReader) { + return xmlReader.IsStartElement(@"CustomerSchemaOrders", @""); + } + + protected override void Serialize(object objectToSerialize, System.Xml.Serialization.XmlSerializationWriter writer) { + ((BaseWriter)writer).Write3_CustomerSchemaOrders(objectToSerialize); + } + + protected override object Deserialize(System.Xml.Serialization.XmlSerializationReader reader) { + return ((BaseReader)reader).Read3_CustomerSchemaOrders(); + } + } + + internal partial class CustomerSchemaOrdersSerializer { + internal class XmlSerializerContract : global::System.Xml.Serialization.XmlSerializerImplementation { + public override global::System.Xml.Serialization.XmlSerializationReader Reader { get { return new CustomerSchemaOrdersSerializer.BaseReader(); } } + public override global::System.Xml.Serialization.XmlSerializationWriter Writer { get { return new CustomerSchemaOrdersSerializer.BaseWriter(); } } + System.Collections.Hashtable readMethods = null; + public override System.Collections.Hashtable ReadMethods { + get { + if (readMethods == null) { + System.Collections.Hashtable _tmp = new System.Collections.Hashtable(); + _tmp[@"Mvp.Xml.Design.Tests.CustomerSchemaOrders::"] = @"Read3_CustomerSchemaOrders"; + if (readMethods == null) readMethods = _tmp; + } + return readMethods; + } + } + System.Collections.Hashtable writeMethods = null; + public override System.Collections.Hashtable WriteMethods { + get { + if (writeMethods == null) { + System.Collections.Hashtable _tmp = new System.Collections.Hashtable(); + _tmp[@"Mvp.Xml.Design.Tests.CustomerSchemaOrders::"] = @"Write3_CustomerSchemaOrders"; + if (writeMethods == null) writeMethods = _tmp; + } + return writeMethods; + } + } + System.Collections.Hashtable typedSerializers = null; + public override System.Collections.Hashtable TypedSerializers { + get { + if (typedSerializers == null) { + System.Collections.Hashtable _tmp = new System.Collections.Hashtable(); + _tmp.Add(@"Mvp.Xml.Design.Tests.CustomerSchemaOrders::", new CustomerSchemaOrdersSerializer()); + if (typedSerializers == null) typedSerializers = _tmp; + } + return typedSerializers; + } + } + public override System.Boolean CanSerialize(System.Type type) { + if (type == typeof(global::Mvp.Xml.Design.Tests.CustomerSchemaOrders)) return true; + return false; + } + public override System.Xml.Serialization.XmlSerializer GetSerializer(System.Type type) { + if (type == typeof(global::Mvp.Xml.Design.Tests.CustomerSchemaOrders)) return new CustomerSchemaOrdersSerializer(); + return null; + } + } + } +} + + #pragma warning restore 0642, 0219 Index: Mvp.Xml.Design.Tests.csproj =================================================================== RCS file: /cvsroot/mvp-xml/Design/v2/tests/Mvp.Xml.Design.Tests.csproj,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Mvp.Xml.Design.Tests.csproj 31 Oct 2005 11:49:18 -0000 1.2 +++ Mvp.Xml.Design.Tests.csproj 31 Oct 2005 12:28:17 -0000 1.3 @@ -123,7 +123,7 @@ </PropertyGroup> <ProjectExtensions> <VisualStudio> - <UserProperties Mvp__Xml__Design__Tests___CustomerSchema__xsd___CustomerSchema__cs="Mvp.Xml.Design.Tests.CustomerSchema;CustomerSchemaSerialization" Mvp__Xml__Design__Tests___Customer__cs="Mvp.Xml.Design.Tests.Customer;Mvp.Xml.Design.Tests" /> + <UserProperties Mvp__Xml__Design__Tests___CustomerSchema__xsd___CustomerSchema__cs="Mvp.Xml.Design.Tests.CustomerSchema;CustomerSchemaSerialization|Mvp.Xml.Design.Tests.CustomerSchemaOrders;CustomerSchemaSerialization" Mvp__Xml__Design__Tests___Customer__cs="Mvp.Xml.Design.Tests.Customer;Mvp.Xml.Design.Tests" /> </VisualStudio> </ProjectExtensions> </Project> \ No newline at end of file |