1 // It is automatically generated
2 using System;
3 using System.Xml;
4 using System.Xml.Schema;
5 using System.Xml.Serialization;
6 using System.Text;
7 using System.Collections;
8 using System.Globalization;
9 
10 namespace DbLinq.Schema.Dbml
11 {
12 	#if !MONO_STRICT
13 	public
14 	#endif
15 	class GeneratedReader : XmlSerializationReader
16 	{
17 		static readonly System.Reflection.MethodInfo fromBinHexStringMethod = typeof (XmlConvert).GetMethod ("FromBinHexString", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic, null, new System.Type [] {typeof (string)}, null);
FromBinHexString(string input)18 		static byte [] FromBinHexString (string input)
19 		{
20 			return input == null ? null : (byte []) fromBinHexStringMethod.Invoke (null, new object [] {input});
21 		}
ReadRoot_Database()22 		public object ReadRoot_Database ()
23 		{
24 			Reader.MoveToContent();
25 			if (Reader.LocalName != "Database" || Reader.NamespaceURI != "http://schemas.microsoft.com/linqtosql/dbml/2007")
26 				throw CreateUnknownNodeException();
27 			return ReadObject_Database (false, true);
28 		}
29 
ReadObject_Database(bool isNullable, bool checkType)30 		public DbLinq.Schema.Dbml.Database ReadObject_Database (bool isNullable, bool checkType)
31 		{
32 			DbLinq.Schema.Dbml.Database ob = null;
33 			if (isNullable && ReadNull()) return null;
34 
35 			if (checkType)
36 			{
37 				System.Xml.XmlQualifiedName t = GetXsiType();
38 				if (t == null)
39 				{ }
40 				else if (t.Name != "Database" || t.Namespace != "http://schemas.microsoft.com/linqtosql/dbml/2007")
41 					throw CreateUnknownTypeException(t);
42 			}
43 
44 			ob = (DbLinq.Schema.Dbml.Database) Activator.CreateInstance(typeof(DbLinq.Schema.Dbml.Database), true);
45 
46 			Reader.MoveToElement();
47 
48 			while (Reader.MoveToNextAttribute())
49 			{
50 				if (Reader.LocalName == "Name" && Reader.NamespaceURI == "") {
51 					ob.@Name = Reader.Value;
52 				}
53 				else if (Reader.LocalName == "EntityNamespace" && Reader.NamespaceURI == "") {
54 					ob.@EntityNamespace = Reader.Value;
55 				}
56 				else if (Reader.LocalName == "ContextNamespace" && Reader.NamespaceURI == "") {
57 					ob.@ContextNamespace = Reader.Value;
58 				}
59 				else if (Reader.LocalName == "Class" && Reader.NamespaceURI == "") {
60 					ob.@Class = Reader.Value;
61 				}
62 				else if (Reader.LocalName == "AccessModifier" && Reader.NamespaceURI == "") {
63 					ob.@AccessModifier = GetEnumValue_AccessModifier (Reader.Value);
64 					ob.AccessModifierSpecified = true;
65 				}
66 				else if (Reader.LocalName == "Modifier" && Reader.NamespaceURI == "") {
67 					ob.@Modifier = GetEnumValue_ClassModifier (Reader.Value);
68 					ob.ModifierSpecified = true;
69 				}
70 				else if (Reader.LocalName == "BaseType" && Reader.NamespaceURI == "") {
71 					ob.@BaseType = Reader.Value;
72 				}
73 				else if (Reader.LocalName == "Provider" && Reader.NamespaceURI == "") {
74 					ob.@Provider = Reader.Value;
75 				}
76 				else if (Reader.LocalName == "ExternalMapping" && Reader.NamespaceURI == "") {
77 					ob.@ExternalMapping = XmlConvert.ToBoolean (Reader.Value);
78 					ob.ExternalMappingSpecified = true;
79 				}
80 				else if (Reader.LocalName == "Serialization" && Reader.NamespaceURI == "") {
81 					ob.@Serialization = GetEnumValue_SerializationMode (Reader.Value);
82 					ob.SerializationSpecified = true;
83 				}
84 				else if (Reader.LocalName == "EntityBase" && Reader.NamespaceURI == "") {
85 					ob.@EntityBase = Reader.Value;
86 				}
87 				else if (IsXmlnsAttribute (Reader.Name)) {
88 				}
89 				else {
90 					UnknownNode (ob);
91 				}
92 			}
93 
94 			Reader.MoveToElement ();
95 			Reader.MoveToElement();
96 			if (Reader.IsEmptyElement) {
97 				Reader.Skip ();
98 				return ob;
99 			}
100 
101 			Reader.ReadStartElement();
102 			Reader.MoveToContent();
103 
104 			bool b0=false, b1=false, b2=false;
105 
106 			DbLinq.Schema.Dbml.Table[] o4;
107 			o4 = null;
108 			DbLinq.Schema.Dbml.Function[] o6;
109 			o6 = null;
110 			int n3=0, n5=0;
111 
112 			while (Reader.NodeType != System.Xml.XmlNodeType.EndElement)
113 			{
114 				if (Reader.NodeType == System.Xml.XmlNodeType.Element)
115 				{
116 					if (Reader.LocalName == "Table" && Reader.NamespaceURI == "http://schemas.microsoft.com/linqtosql/dbml/2007" && !b1) {
117 						o4 = (DbLinq.Schema.Dbml.Table[]) EnsureArrayIndex (o4, n3, typeof(DbLinq.Schema.Dbml.Table));
118 						o4[n3] = ReadObject_Table (false, true);
119 						n3++;
120 					}
121 					else if (Reader.LocalName == "Function" && Reader.NamespaceURI == "http://schemas.microsoft.com/linqtosql/dbml/2007" && !b2) {
122 						o6 = (DbLinq.Schema.Dbml.Function[]) EnsureArrayIndex (o6, n5, typeof(DbLinq.Schema.Dbml.Function));
123 						o6[n5] = ReadObject_Function (false, true);
124 						n5++;
125 					}
126 					else if (Reader.LocalName == "Connection" && Reader.NamespaceURI == "http://schemas.microsoft.com/linqtosql/dbml/2007" && !b0) {
127 						b0 = true;
128 						ob.@Connection = ReadObject_Connection (false, true);
129 					}
130 					else {
131 						UnknownNode (ob);
132 					}
133 				}
134 				else
135 					UnknownNode(ob);
136 
137 				Reader.MoveToContent();
138 			}
139 
140 			o4 = (DbLinq.Schema.Dbml.Table[]) ShrinkArray (o4, n3, typeof(DbLinq.Schema.Dbml.Table), true);
141 			ob.@Table = o4;
142 			o6 = (DbLinq.Schema.Dbml.Function[]) ShrinkArray (o6, n5, typeof(DbLinq.Schema.Dbml.Function), true);
143 			ob.@Function = o6;
144 
145 			ReadEndElement();
146 
147 			return ob;
148 		}
149 
ReadObject_AccessModifier(bool isNullable, bool checkType)150 		public DbLinq.Schema.Dbml.AccessModifier ReadObject_AccessModifier (bool isNullable, bool checkType)
151 		{
152 			Reader.ReadStartElement ();
153 			DbLinq.Schema.Dbml.AccessModifier res = GetEnumValue_AccessModifier (Reader.ReadString());
154 			if (Reader.NodeType != XmlNodeType.None)
155 			Reader.ReadEndElement ();
156 			return res;
157 		}
158 
GetEnumValue_AccessModifier(string xmlName)159 		DbLinq.Schema.Dbml.AccessModifier GetEnumValue_AccessModifier (string xmlName)
160 		{
161 			switch (xmlName)
162 			{
163 				case "Public": return DbLinq.Schema.Dbml.AccessModifier.Public;
164 				case "Internal": return DbLinq.Schema.Dbml.AccessModifier.Internal;
165 				case "Protected": return DbLinq.Schema.Dbml.AccessModifier.Protected;
166 				case "ProtectedInternal": return DbLinq.Schema.Dbml.AccessModifier.ProtectedInternal;
167 				case "Private": return DbLinq.Schema.Dbml.AccessModifier.Private;
168 				default:
169 					throw CreateUnknownConstantException (xmlName, typeof(DbLinq.Schema.Dbml.AccessModifier));
170 			}
171 		}
172 
ReadObject_ClassModifier(bool isNullable, bool checkType)173 		public DbLinq.Schema.Dbml.ClassModifier ReadObject_ClassModifier (bool isNullable, bool checkType)
174 		{
175 			Reader.ReadStartElement ();
176 			DbLinq.Schema.Dbml.ClassModifier res = GetEnumValue_ClassModifier (Reader.ReadString());
177 			if (Reader.NodeType != XmlNodeType.None)
178 			Reader.ReadEndElement ();
179 			return res;
180 		}
181 
GetEnumValue_ClassModifier(string xmlName)182 		DbLinq.Schema.Dbml.ClassModifier GetEnumValue_ClassModifier (string xmlName)
183 		{
184 			switch (xmlName)
185 			{
186 				case "Sealed": return DbLinq.Schema.Dbml.ClassModifier.Sealed;
187 				case "Abstract": return DbLinq.Schema.Dbml.ClassModifier.Abstract;
188 				default:
189 					throw CreateUnknownConstantException (xmlName, typeof(DbLinq.Schema.Dbml.ClassModifier));
190 			}
191 		}
192 
ReadObject_SerializationMode(bool isNullable, bool checkType)193 		public DbLinq.Schema.Dbml.SerializationMode ReadObject_SerializationMode (bool isNullable, bool checkType)
194 		{
195 			Reader.ReadStartElement ();
196 			DbLinq.Schema.Dbml.SerializationMode res = GetEnumValue_SerializationMode (Reader.ReadString());
197 			if (Reader.NodeType != XmlNodeType.None)
198 			Reader.ReadEndElement ();
199 			return res;
200 		}
201 
GetEnumValue_SerializationMode(string xmlName)202 		DbLinq.Schema.Dbml.SerializationMode GetEnumValue_SerializationMode (string xmlName)
203 		{
204 			switch (xmlName)
205 			{
206 				case "None": return DbLinq.Schema.Dbml.SerializationMode.None;
207 				case "Unidirectional": return DbLinq.Schema.Dbml.SerializationMode.Unidirectional;
208 				default:
209 					throw CreateUnknownConstantException (xmlName, typeof(DbLinq.Schema.Dbml.SerializationMode));
210 			}
211 		}
212 
ReadObject_Table(bool isNullable, bool checkType)213 		public DbLinq.Schema.Dbml.Table ReadObject_Table (bool isNullable, bool checkType)
214 		{
215 			DbLinq.Schema.Dbml.Table ob = null;
216 			if (isNullable && ReadNull()) return null;
217 
218 			if (checkType)
219 			{
220 				System.Xml.XmlQualifiedName t = GetXsiType();
221 				if (t == null)
222 				{ }
223 				else if (t.Name != "Table" || t.Namespace != "http://schemas.microsoft.com/linqtosql/dbml/2007")
224 					throw CreateUnknownTypeException(t);
225 			}
226 
227 			ob = (DbLinq.Schema.Dbml.Table) Activator.CreateInstance(typeof(DbLinq.Schema.Dbml.Table), true);
228 
229 			Reader.MoveToElement();
230 
231 			while (Reader.MoveToNextAttribute())
232 			{
233 				if (Reader.LocalName == "Name" && Reader.NamespaceURI == "") {
234 					ob.@Name = Reader.Value;
235 				}
236 				else if (Reader.LocalName == "Member" && Reader.NamespaceURI == "") {
237 					ob.@Member = Reader.Value;
238 				}
239 				else if (Reader.LocalName == "AccessModifier" && Reader.NamespaceURI == "") {
240 					ob.@AccessModifier = GetEnumValue_AccessModifier (Reader.Value);
241 					ob.AccessModifierSpecified = true;
242 				}
243 				else if (Reader.LocalName == "Modifier" && Reader.NamespaceURI == "") {
244 					ob.@Modifier = GetEnumValue_MemberModifier (Reader.Value);
245 					ob.ModifierSpecified = true;
246 				}
247 				else if (IsXmlnsAttribute (Reader.Name)) {
248 				}
249 				else {
250 					UnknownNode (ob);
251 				}
252 			}
253 
254 			Reader.MoveToElement ();
255 			Reader.MoveToElement();
256 			if (Reader.IsEmptyElement) {
257 				Reader.Skip ();
258 				return ob;
259 			}
260 
261 			Reader.ReadStartElement();
262 			Reader.MoveToContent();
263 
264 			bool b7=false, b8=false, b9=false, b10=false;
265 
266 			while (Reader.NodeType != System.Xml.XmlNodeType.EndElement)
267 			{
268 				if (Reader.NodeType == System.Xml.XmlNodeType.Element)
269 				{
270 					if (Reader.LocalName == "UpdateFunction" && Reader.NamespaceURI == "http://schemas.microsoft.com/linqtosql/dbml/2007" && !b9) {
271 						b9 = true;
272 						ob.@UpdateFunction = ReadObject_TableFunction (false, true);
273 					}
274 					else if (Reader.LocalName == "Type" && Reader.NamespaceURI == "http://schemas.microsoft.com/linqtosql/dbml/2007" && !b7) {
275 						b7 = true;
276 						ob.@Type = ReadObject_Type (false, true);
277 					}
278 					else if (Reader.LocalName == "InsertFunction" && Reader.NamespaceURI == "http://schemas.microsoft.com/linqtosql/dbml/2007" && !b8) {
279 						b8 = true;
280 						ob.@InsertFunction = ReadObject_TableFunction (false, true);
281 					}
282 					else if (Reader.LocalName == "DeleteFunction" && Reader.NamespaceURI == "http://schemas.microsoft.com/linqtosql/dbml/2007" && !b10) {
283 						b10 = true;
284 						ob.@DeleteFunction = ReadObject_TableFunction (false, true);
285 					}
286 					else {
287 						UnknownNode (ob);
288 					}
289 				}
290 				else
291 					UnknownNode(ob);
292 
293 				Reader.MoveToContent();
294 			}
295 
296 			ReadEndElement();
297 
298 			return ob;
299 		}
300 
ReadObject_Function(bool isNullable, bool checkType)301 		public DbLinq.Schema.Dbml.Function ReadObject_Function (bool isNullable, bool checkType)
302 		{
303 			DbLinq.Schema.Dbml.Function ob = null;
304 			if (isNullable && ReadNull()) return null;
305 
306 			if (checkType)
307 			{
308 				System.Xml.XmlQualifiedName t = GetXsiType();
309 				if (t == null)
310 				{ }
311 				else if (t.Name != "Function" || t.Namespace != "http://schemas.microsoft.com/linqtosql/dbml/2007")
312 					throw CreateUnknownTypeException(t);
313 			}
314 
315 			ob = (DbLinq.Schema.Dbml.Function) Activator.CreateInstance(typeof(DbLinq.Schema.Dbml.Function), true);
316 
317 			Reader.MoveToElement();
318 
319 			while (Reader.MoveToNextAttribute())
320 			{
321 				if (Reader.LocalName == "Name" && Reader.NamespaceURI == "") {
322 					ob.@Name = Reader.Value;
323 				}
324 				else if (Reader.LocalName == "Id" && Reader.NamespaceURI == "") {
325 					ob.@Id = Reader.Value;
326 				}
327 				else if (Reader.LocalName == "Method" && Reader.NamespaceURI == "") {
328 					ob.@Method = Reader.Value;
329 				}
330 				else if (Reader.LocalName == "AccessModifier" && Reader.NamespaceURI == "") {
331 					ob.@AccessModifier = GetEnumValue_AccessModifier (Reader.Value);
332 					ob.AccessModifierSpecified = true;
333 				}
334 				else if (Reader.LocalName == "Modifier" && Reader.NamespaceURI == "") {
335 					ob.@Modifier = GetEnumValue_MemberModifier (Reader.Value);
336 					ob.ModifierSpecified = true;
337 				}
338 				else if (Reader.LocalName == "HasMultipleResults" && Reader.NamespaceURI == "") {
339 					ob.@HasMultipleResults = XmlConvert.ToBoolean (Reader.Value);
340 					ob.HasMultipleResultsSpecified = true;
341 				}
342 				else if (Reader.LocalName == "IsComposable" && Reader.NamespaceURI == "") {
343 					ob.@IsComposable = XmlConvert.ToBoolean (Reader.Value);
344 					ob.IsComposableSpecified = true;
345 				}
346 				else if (IsXmlnsAttribute (Reader.Name)) {
347 				}
348 				else {
349 					UnknownNode (ob);
350 				}
351 			}
352 
353 			Reader.MoveToElement ();
354 			Reader.MoveToElement();
355 			if (Reader.IsEmptyElement) {
356 				Reader.Skip ();
357 				return ob;
358 			}
359 
360 			Reader.ReadStartElement();
361 			Reader.MoveToContent();
362 
363 			bool b11=false, b12=false;
364 
365 			DbLinq.Schema.Dbml.Parameter[] o14;
366 			o14 = null;
367 			System.Object[] o16;
368 			o16 = null;
369 			int n13=0, n15=0;
370 
371 			while (Reader.NodeType != System.Xml.XmlNodeType.EndElement)
372 			{
373 				if (Reader.NodeType == System.Xml.XmlNodeType.Element)
374 				{
375 					if (Reader.LocalName == "Return" && Reader.NamespaceURI == "http://schemas.microsoft.com/linqtosql/dbml/2007" && !b12) {
376 						o16 = (System.Object[]) EnsureArrayIndex (o16, n15, typeof(System.Object));
377 						o16[n15] = ReadObject_Return (false, true);
378 						n15++;
379 					}
380 					else if (Reader.LocalName == "ElementType" && Reader.NamespaceURI == "http://schemas.microsoft.com/linqtosql/dbml/2007" && !b12) {
381 						o16 = (System.Object[]) EnsureArrayIndex (o16, n15, typeof(System.Object));
382 						o16[n15] = ReadObject_Type (false, true);
383 						n15++;
384 					}
385 					else if (Reader.LocalName == "Parameter" && Reader.NamespaceURI == "http://schemas.microsoft.com/linqtosql/dbml/2007" && !b11) {
386 						o14 = (DbLinq.Schema.Dbml.Parameter[]) EnsureArrayIndex (o14, n13, typeof(DbLinq.Schema.Dbml.Parameter));
387 						o14[n13] = ReadObject_Parameter (false, true);
388 						n13++;
389 					}
390 					else {
391 						UnknownNode (ob);
392 					}
393 				}
394 				else
395 					UnknownNode(ob);
396 
397 				Reader.MoveToContent();
398 			}
399 
400 			o14 = (DbLinq.Schema.Dbml.Parameter[]) ShrinkArray (o14, n13, typeof(DbLinq.Schema.Dbml.Parameter), true);
401 			ob.@Parameter = o14;
402 			o16 = (System.Object[]) ShrinkArray (o16, n15, typeof(System.Object), true);
403 			ob.@Items = o16;
404 
405 			ReadEndElement();
406 
407 			return ob;
408 		}
409 
ReadObject_Connection(bool isNullable, bool checkType)410 		public DbLinq.Schema.Dbml.Connection ReadObject_Connection (bool isNullable, bool checkType)
411 		{
412 			DbLinq.Schema.Dbml.Connection ob = null;
413 			if (isNullable && ReadNull()) return null;
414 
415 			if (checkType)
416 			{
417 				System.Xml.XmlQualifiedName t = GetXsiType();
418 				if (t == null)
419 				{ }
420 				else if (t.Name != "Connection" || t.Namespace != "http://schemas.microsoft.com/linqtosql/dbml/2007")
421 					throw CreateUnknownTypeException(t);
422 			}
423 
424 			ob = (DbLinq.Schema.Dbml.Connection) Activator.CreateInstance(typeof(DbLinq.Schema.Dbml.Connection), true);
425 
426 			Reader.MoveToElement();
427 
428 			while (Reader.MoveToNextAttribute())
429 			{
430 				if (Reader.LocalName == "Provider" && Reader.NamespaceURI == "") {
431 					ob.@Provider = Reader.Value;
432 				}
433 				else if (Reader.LocalName == "Mode" && Reader.NamespaceURI == "") {
434 					ob.@Mode = GetEnumValue_ConnectionMode (Reader.Value);
435 					ob.ModeSpecified = true;
436 				}
437 				else if (Reader.LocalName == "ConnectionString" && Reader.NamespaceURI == "") {
438 					ob.@ConnectionString = Reader.Value;
439 				}
440 				else if (Reader.LocalName == "SettingsObjectName" && Reader.NamespaceURI == "") {
441 					ob.@SettingsObjectName = Reader.Value;
442 				}
443 				else if (Reader.LocalName == "SettingsPropertyName" && Reader.NamespaceURI == "") {
444 					ob.@SettingsPropertyName = Reader.Value;
445 				}
446 				else if (IsXmlnsAttribute (Reader.Name)) {
447 				}
448 				else {
449 					UnknownNode (ob);
450 				}
451 			}
452 
453 			Reader.MoveToElement ();
454 			Reader.MoveToElement();
455 			if (Reader.IsEmptyElement) {
456 				Reader.Skip ();
457 				return ob;
458 			}
459 
460 			Reader.ReadStartElement();
461 			Reader.MoveToContent();
462 
463 			while (Reader.NodeType != System.Xml.XmlNodeType.EndElement)
464 			{
465 				if (Reader.NodeType == System.Xml.XmlNodeType.Element)
466 				{
467 					UnknownNode (ob);
468 				}
469 				else
470 					UnknownNode(ob);
471 
472 				Reader.MoveToContent();
473 			}
474 
475 			ReadEndElement();
476 
477 			return ob;
478 		}
479 
ReadObject_MemberModifier(bool isNullable, bool checkType)480 		public DbLinq.Schema.Dbml.MemberModifier ReadObject_MemberModifier (bool isNullable, bool checkType)
481 		{
482 			Reader.ReadStartElement ();
483 			DbLinq.Schema.Dbml.MemberModifier res = GetEnumValue_MemberModifier (Reader.ReadString());
484 			if (Reader.NodeType != XmlNodeType.None)
485 			Reader.ReadEndElement ();
486 			return res;
487 		}
488 
GetEnumValue_MemberModifier(string xmlName)489 		DbLinq.Schema.Dbml.MemberModifier GetEnumValue_MemberModifier (string xmlName)
490 		{
491 			switch (xmlName)
492 			{
493 				case "Virtual": return DbLinq.Schema.Dbml.MemberModifier.Virtual;
494 				case "Override": return DbLinq.Schema.Dbml.MemberModifier.Override;
495 				case "New": return DbLinq.Schema.Dbml.MemberModifier.New;
496 				case "NewVirtual": return DbLinq.Schema.Dbml.MemberModifier.NewVirtual;
497 				default:
498 					throw CreateUnknownConstantException (xmlName, typeof(DbLinq.Schema.Dbml.MemberModifier));
499 			}
500 		}
501 
ReadObject_TableFunction(bool isNullable, bool checkType)502 		public DbLinq.Schema.Dbml.TableFunction ReadObject_TableFunction (bool isNullable, bool checkType)
503 		{
504 			DbLinq.Schema.Dbml.TableFunction ob = null;
505 			if (isNullable && ReadNull()) return null;
506 
507 			if (checkType)
508 			{
509 				System.Xml.XmlQualifiedName t = GetXsiType();
510 				if (t == null)
511 				{ }
512 				else if (t.Name != "TableFunction" || t.Namespace != "http://schemas.microsoft.com/linqtosql/dbml/2007")
513 					throw CreateUnknownTypeException(t);
514 			}
515 
516 			ob = (DbLinq.Schema.Dbml.TableFunction) Activator.CreateInstance(typeof(DbLinq.Schema.Dbml.TableFunction), true);
517 
518 			Reader.MoveToElement();
519 
520 			while (Reader.MoveToNextAttribute())
521 			{
522 				if (Reader.LocalName == "FunctionId" && Reader.NamespaceURI == "") {
523 					ob.@FunctionId = Reader.Value;
524 				}
525 				else if (Reader.LocalName == "AccessModifier" && Reader.NamespaceURI == "") {
526 					ob.@AccessModifier = GetEnumValue_AccessModifier (Reader.Value);
527 					ob.AccessModifierSpecified = true;
528 				}
529 				else if (IsXmlnsAttribute (Reader.Name)) {
530 				}
531 				else {
532 					UnknownNode (ob);
533 				}
534 			}
535 
536 			Reader.MoveToElement ();
537 			Reader.MoveToElement();
538 			if (Reader.IsEmptyElement) {
539 				Reader.Skip ();
540 				return ob;
541 			}
542 
543 			Reader.ReadStartElement();
544 			Reader.MoveToContent();
545 
546 			bool b17=false, b18=false;
547 
548 			DbLinq.Schema.Dbml.TableFunctionParameter[] o20;
549 			o20 = null;
550 			int n19=0;
551 
552 			while (Reader.NodeType != System.Xml.XmlNodeType.EndElement)
553 			{
554 				if (Reader.NodeType == System.Xml.XmlNodeType.Element)
555 				{
556 					if (Reader.LocalName == "Return" && Reader.NamespaceURI == "http://schemas.microsoft.com/linqtosql/dbml/2007" && !b18) {
557 						b18 = true;
558 						ob.@Return = ReadObject_TableFunctionReturn (false, true);
559 					}
560 					else if (Reader.LocalName == "Argument" && Reader.NamespaceURI == "http://schemas.microsoft.com/linqtosql/dbml/2007" && !b17) {
561 						o20 = (DbLinq.Schema.Dbml.TableFunctionParameter[]) EnsureArrayIndex (o20, n19, typeof(DbLinq.Schema.Dbml.TableFunctionParameter));
562 						o20[n19] = ReadObject_TableFunctionParameter (false, true);
563 						n19++;
564 					}
565 					else {
566 						UnknownNode (ob);
567 					}
568 				}
569 				else
570 					UnknownNode(ob);
571 
572 				Reader.MoveToContent();
573 			}
574 
575 			o20 = (DbLinq.Schema.Dbml.TableFunctionParameter[]) ShrinkArray (o20, n19, typeof(DbLinq.Schema.Dbml.TableFunctionParameter), true);
576 			ob.@Argument = o20;
577 
578 			ReadEndElement();
579 
580 			return ob;
581 		}
582 
ReadObject_Type(bool isNullable, bool checkType)583 		public DbLinq.Schema.Dbml.Type ReadObject_Type (bool isNullable, bool checkType)
584 		{
585 			DbLinq.Schema.Dbml.Type ob = null;
586 			if (isNullable && ReadNull()) return null;
587 
588 			if (checkType)
589 			{
590 				System.Xml.XmlQualifiedName t = GetXsiType();
591 				if (t == null)
592 				{ }
593 				else if (t.Name != "Type" || t.Namespace != "http://schemas.microsoft.com/linqtosql/dbml/2007")
594 					throw CreateUnknownTypeException(t);
595 			}
596 
597 			ob = (DbLinq.Schema.Dbml.Type) Activator.CreateInstance(typeof(DbLinq.Schema.Dbml.Type), true);
598 
599 			Reader.MoveToElement();
600 
601 			while (Reader.MoveToNextAttribute())
602 			{
603 				if (Reader.LocalName == "IdRef" && Reader.NamespaceURI == "") {
604 					ob.@IdRef = Reader.Value;
605 				}
606 				else if (Reader.LocalName == "Id" && Reader.NamespaceURI == "") {
607 					ob.@Id = Reader.Value;
608 				}
609 				else if (Reader.LocalName == "Name" && Reader.NamespaceURI == "") {
610 					ob.@Name = Reader.Value;
611 				}
612 				else if (Reader.LocalName == "InheritanceCode" && Reader.NamespaceURI == "") {
613 					ob.@InheritanceCode = Reader.Value;
614 				}
615 				else if (Reader.LocalName == "IsInheritanceDefault" && Reader.NamespaceURI == "") {
616 					ob.@IsInheritanceDefault = XmlConvert.ToBoolean (Reader.Value);
617 					ob.IsInheritanceDefaultSpecified = true;
618 				}
619 				else if (Reader.LocalName == "AccessModifier" && Reader.NamespaceURI == "") {
620 					ob.@AccessModifier = GetEnumValue_AccessModifier (Reader.Value);
621 					ob.AccessModifierSpecified = true;
622 				}
623 				else if (Reader.LocalName == "Modifier" && Reader.NamespaceURI == "") {
624 					ob.@Modifier = GetEnumValue_ClassModifier (Reader.Value);
625 					ob.ModifierSpecified = true;
626 				}
627 				else if (IsXmlnsAttribute (Reader.Name)) {
628 				}
629 				else {
630 					UnknownNode (ob);
631 				}
632 			}
633 
634 			Reader.MoveToElement ();
635 			Reader.MoveToElement();
636 			if (Reader.IsEmptyElement) {
637 				Reader.Skip ();
638 				return ob;
639 			}
640 
641 			Reader.ReadStartElement();
642 			Reader.MoveToContent();
643 
644 			bool b21=false, b22=false;
645 
646 			System.Object[] o24;
647 			o24 = null;
648 			DbLinq.Schema.Dbml.Type[] o26;
649 			o26 = null;
650 			int n23=0, n25=0;
651 
652 			while (Reader.NodeType != System.Xml.XmlNodeType.EndElement)
653 			{
654 				if (Reader.NodeType == System.Xml.XmlNodeType.Element)
655 				{
656 					if (Reader.LocalName == "Column" && Reader.NamespaceURI == "http://schemas.microsoft.com/linqtosql/dbml/2007" && !b21) {
657 						o24 = (System.Object[]) EnsureArrayIndex (o24, n23, typeof(System.Object));
658 						o24[n23] = ReadObject_Column (false, true);
659 						n23++;
660 					}
661 					else if (Reader.LocalName == "Association" && Reader.NamespaceURI == "http://schemas.microsoft.com/linqtosql/dbml/2007" && !b21) {
662 						o24 = (System.Object[]) EnsureArrayIndex (o24, n23, typeof(System.Object));
663 						o24[n23] = ReadObject_Association (false, true);
664 						n23++;
665 					}
666 					else if (Reader.LocalName == "Type" && Reader.NamespaceURI == "http://schemas.microsoft.com/linqtosql/dbml/2007" && !b22) {
667 						o26 = (DbLinq.Schema.Dbml.Type[]) EnsureArrayIndex (o26, n25, typeof(DbLinq.Schema.Dbml.Type));
668 						o26[n25] = ReadObject_Type (false, true);
669 						n25++;
670 					}
671 					else {
672 						UnknownNode (ob);
673 					}
674 				}
675 				else
676 					UnknownNode(ob);
677 
678 				Reader.MoveToContent();
679 			}
680 
681 			o24 = (System.Object[]) ShrinkArray (o24, n23, typeof(System.Object), true);
682 			ob.@Items = o24;
683 			o26 = (DbLinq.Schema.Dbml.Type[]) ShrinkArray (o26, n25, typeof(DbLinq.Schema.Dbml.Type), true);
684 			ob.@Type1 = o26;
685 
686 			ReadEndElement();
687 
688 			return ob;
689 		}
690 
ReadObject_Return(bool isNullable, bool checkType)691 		public DbLinq.Schema.Dbml.Return ReadObject_Return (bool isNullable, bool checkType)
692 		{
693 			DbLinq.Schema.Dbml.Return ob = null;
694 			if (isNullable && ReadNull()) return null;
695 
696 			if (checkType)
697 			{
698 				System.Xml.XmlQualifiedName t = GetXsiType();
699 				if (t == null)
700 				{ }
701 				else if (t.Name != "Return" || t.Namespace != "http://schemas.microsoft.com/linqtosql/dbml/2007")
702 					throw CreateUnknownTypeException(t);
703 			}
704 
705 			ob = (DbLinq.Schema.Dbml.Return) Activator.CreateInstance(typeof(DbLinq.Schema.Dbml.Return), true);
706 
707 			Reader.MoveToElement();
708 
709 			while (Reader.MoveToNextAttribute())
710 			{
711 				if (Reader.LocalName == "Type" && Reader.NamespaceURI == "") {
712 					ob.@Type = Reader.Value;
713 				}
714 				else if (Reader.LocalName == "DbType" && Reader.NamespaceURI == "") {
715 					ob.@DbType = Reader.Value;
716 				}
717 				else if (IsXmlnsAttribute (Reader.Name)) {
718 				}
719 				else {
720 					UnknownNode (ob);
721 				}
722 			}
723 
724 			Reader.MoveToElement ();
725 			Reader.MoveToElement();
726 			if (Reader.IsEmptyElement) {
727 				Reader.Skip ();
728 				return ob;
729 			}
730 
731 			Reader.ReadStartElement();
732 			Reader.MoveToContent();
733 
734 			while (Reader.NodeType != System.Xml.XmlNodeType.EndElement)
735 			{
736 				if (Reader.NodeType == System.Xml.XmlNodeType.Element)
737 				{
738 					UnknownNode (ob);
739 				}
740 				else
741 					UnknownNode(ob);
742 
743 				Reader.MoveToContent();
744 			}
745 
746 			ReadEndElement();
747 
748 			return ob;
749 		}
750 
ReadObject_Parameter(bool isNullable, bool checkType)751 		public DbLinq.Schema.Dbml.Parameter ReadObject_Parameter (bool isNullable, bool checkType)
752 		{
753 			DbLinq.Schema.Dbml.Parameter ob = null;
754 			if (isNullable && ReadNull()) return null;
755 
756 			if (checkType)
757 			{
758 				System.Xml.XmlQualifiedName t = GetXsiType();
759 				if (t == null)
760 				{ }
761 				else if (t.Name != "Parameter" || t.Namespace != "http://schemas.microsoft.com/linqtosql/dbml/2007")
762 					throw CreateUnknownTypeException(t);
763 			}
764 
765 			ob = (DbLinq.Schema.Dbml.Parameter) Activator.CreateInstance(typeof(DbLinq.Schema.Dbml.Parameter), true);
766 
767 			Reader.MoveToElement();
768 
769 			while (Reader.MoveToNextAttribute())
770 			{
771 				if (Reader.LocalName == "Name" && Reader.NamespaceURI == "") {
772 					ob.@Name = Reader.Value;
773 				}
774 				else if (Reader.LocalName == "Parameter" && Reader.NamespaceURI == "") {
775 					ob.@Parameter1 = Reader.Value;
776 				}
777 				else if (Reader.LocalName == "Type" && Reader.NamespaceURI == "") {
778 					ob.@Type = Reader.Value;
779 				}
780 				else if (Reader.LocalName == "DbType" && Reader.NamespaceURI == "") {
781 					ob.@DbType = Reader.Value;
782 				}
783 				else if (Reader.LocalName == "Direction" && Reader.NamespaceURI == "") {
784 					ob.@Direction = GetEnumValue_ParameterDirection (Reader.Value);
785 					ob.DirectionSpecified = true;
786 				}
787 				else if (IsXmlnsAttribute (Reader.Name)) {
788 				}
789 				else {
790 					UnknownNode (ob);
791 				}
792 			}
793 
794 			Reader.MoveToElement ();
795 			Reader.MoveToElement();
796 			if (Reader.IsEmptyElement) {
797 				Reader.Skip ();
798 				return ob;
799 			}
800 
801 			Reader.ReadStartElement();
802 			Reader.MoveToContent();
803 
804 			while (Reader.NodeType != System.Xml.XmlNodeType.EndElement)
805 			{
806 				if (Reader.NodeType == System.Xml.XmlNodeType.Element)
807 				{
808 					UnknownNode (ob);
809 				}
810 				else
811 					UnknownNode(ob);
812 
813 				Reader.MoveToContent();
814 			}
815 
816 			ReadEndElement();
817 
818 			return ob;
819 		}
820 
ReadObject_ConnectionMode(bool isNullable, bool checkType)821 		public DbLinq.Schema.Dbml.ConnectionMode ReadObject_ConnectionMode (bool isNullable, bool checkType)
822 		{
823 			Reader.ReadStartElement ();
824 			DbLinq.Schema.Dbml.ConnectionMode res = GetEnumValue_ConnectionMode (Reader.ReadString());
825 			if (Reader.NodeType != XmlNodeType.None)
826 			Reader.ReadEndElement ();
827 			return res;
828 		}
829 
GetEnumValue_ConnectionMode(string xmlName)830 		DbLinq.Schema.Dbml.ConnectionMode GetEnumValue_ConnectionMode (string xmlName)
831 		{
832 			switch (xmlName)
833 			{
834 				case "ConnectionString": return DbLinq.Schema.Dbml.ConnectionMode.ConnectionString;
835 				case "AppSettings": return DbLinq.Schema.Dbml.ConnectionMode.AppSettings;
836 				case "WebSettings": return DbLinq.Schema.Dbml.ConnectionMode.WebSettings;
837 				default:
838 					throw CreateUnknownConstantException (xmlName, typeof(DbLinq.Schema.Dbml.ConnectionMode));
839 			}
840 		}
841 
ReadObject_TableFunctionReturn(bool isNullable, bool checkType)842 		public DbLinq.Schema.Dbml.TableFunctionReturn ReadObject_TableFunctionReturn (bool isNullable, bool checkType)
843 		{
844 			DbLinq.Schema.Dbml.TableFunctionReturn ob = null;
845 			if (isNullable && ReadNull()) return null;
846 
847 			if (checkType)
848 			{
849 				System.Xml.XmlQualifiedName t = GetXsiType();
850 				if (t == null)
851 				{ }
852 				else if (t.Name != "TableFunctionReturn" || t.Namespace != "http://schemas.microsoft.com/linqtosql/dbml/2007")
853 					throw CreateUnknownTypeException(t);
854 			}
855 
856 			ob = (DbLinq.Schema.Dbml.TableFunctionReturn) Activator.CreateInstance(typeof(DbLinq.Schema.Dbml.TableFunctionReturn), true);
857 
858 			Reader.MoveToElement();
859 
860 			while (Reader.MoveToNextAttribute())
861 			{
862 				if (Reader.LocalName == "Member" && Reader.NamespaceURI == "") {
863 					ob.@Member = Reader.Value;
864 				}
865 				else if (IsXmlnsAttribute (Reader.Name)) {
866 				}
867 				else {
868 					UnknownNode (ob);
869 				}
870 			}
871 
872 			Reader.MoveToElement ();
873 			Reader.MoveToElement();
874 			if (Reader.IsEmptyElement) {
875 				Reader.Skip ();
876 				return ob;
877 			}
878 
879 			Reader.ReadStartElement();
880 			Reader.MoveToContent();
881 
882 			while (Reader.NodeType != System.Xml.XmlNodeType.EndElement)
883 			{
884 				if (Reader.NodeType == System.Xml.XmlNodeType.Element)
885 				{
886 					UnknownNode (ob);
887 				}
888 				else
889 					UnknownNode(ob);
890 
891 				Reader.MoveToContent();
892 			}
893 
894 			ReadEndElement();
895 
896 			return ob;
897 		}
898 
ReadObject_TableFunctionParameter(bool isNullable, bool checkType)899 		public DbLinq.Schema.Dbml.TableFunctionParameter ReadObject_TableFunctionParameter (bool isNullable, bool checkType)
900 		{
901 			DbLinq.Schema.Dbml.TableFunctionParameter ob = null;
902 			if (isNullable && ReadNull()) return null;
903 
904 			if (checkType)
905 			{
906 				System.Xml.XmlQualifiedName t = GetXsiType();
907 				if (t == null)
908 				{ }
909 				else if (t.Name != "TableFunctionParameter" || t.Namespace != "http://schemas.microsoft.com/linqtosql/dbml/2007")
910 					throw CreateUnknownTypeException(t);
911 			}
912 
913 			ob = (DbLinq.Schema.Dbml.TableFunctionParameter) Activator.CreateInstance(typeof(DbLinq.Schema.Dbml.TableFunctionParameter), true);
914 
915 			Reader.MoveToElement();
916 
917 			while (Reader.MoveToNextAttribute())
918 			{
919 				if (Reader.LocalName == "Parameter" && Reader.NamespaceURI == "") {
920 					ob.@Parameter = Reader.Value;
921 				}
922 				else if (Reader.LocalName == "Member" && Reader.NamespaceURI == "") {
923 					ob.@Member = Reader.Value;
924 				}
925 				else if (Reader.LocalName == "Version" && Reader.NamespaceURI == "") {
926 					ob.@Version = GetEnumValue_Version (Reader.Value);
927 					ob.VersionSpecified = true;
928 				}
929 				else if (IsXmlnsAttribute (Reader.Name)) {
930 				}
931 				else {
932 					UnknownNode (ob);
933 				}
934 			}
935 
936 			Reader.MoveToElement ();
937 			Reader.MoveToElement();
938 			if (Reader.IsEmptyElement) {
939 				Reader.Skip ();
940 				return ob;
941 			}
942 
943 			Reader.ReadStartElement();
944 			Reader.MoveToContent();
945 
946 			while (Reader.NodeType != System.Xml.XmlNodeType.EndElement)
947 			{
948 				if (Reader.NodeType == System.Xml.XmlNodeType.Element)
949 				{
950 					UnknownNode (ob);
951 				}
952 				else
953 					UnknownNode(ob);
954 
955 				Reader.MoveToContent();
956 			}
957 
958 			ReadEndElement();
959 
960 			return ob;
961 		}
962 
ReadObject_Column(bool isNullable, bool checkType)963 		public DbLinq.Schema.Dbml.Column ReadObject_Column (bool isNullable, bool checkType)
964 		{
965 			DbLinq.Schema.Dbml.Column ob = null;
966 			if (isNullable && ReadNull()) return null;
967 
968 			if (checkType)
969 			{
970 				System.Xml.XmlQualifiedName t = GetXsiType();
971 				if (t == null)
972 				{ }
973 				else if (t.Name != "Column" || t.Namespace != "http://schemas.microsoft.com/linqtosql/dbml/2007")
974 					throw CreateUnknownTypeException(t);
975 			}
976 
977 			ob = (DbLinq.Schema.Dbml.Column) Activator.CreateInstance(typeof(DbLinq.Schema.Dbml.Column), true);
978 
979 			Reader.MoveToElement();
980 
981 			while (Reader.MoveToNextAttribute())
982 			{
983 				if (Reader.LocalName == "Name" && Reader.NamespaceURI == "") {
984 					ob.@Name = Reader.Value;
985 				}
986 				else if (Reader.LocalName == "Member" && Reader.NamespaceURI == "") {
987 					ob.@Member = Reader.Value;
988 				}
989 				else if (Reader.LocalName == "Storage" && Reader.NamespaceURI == "") {
990 					ob.@Storage = Reader.Value;
991 				}
992 				else if (Reader.LocalName == "AccessModifier" && Reader.NamespaceURI == "") {
993 					ob.@AccessModifier = GetEnumValue_AccessModifier (Reader.Value);
994 					ob.AccessModifierSpecified = true;
995 				}
996 				else if (Reader.LocalName == "Modifier" && Reader.NamespaceURI == "") {
997 					ob.@Modifier = GetEnumValue_MemberModifier (Reader.Value);
998 					ob.ModifierSpecified = true;
999 				}
1000 				else if (Reader.LocalName == "Type" && Reader.NamespaceURI == "") {
1001 					ob.@Type = Reader.Value;
1002 				}
1003 				else if (Reader.LocalName == "DbType" && Reader.NamespaceURI == "") {
1004 					ob.@DbType = Reader.Value;
1005 				}
1006 				else if (Reader.LocalName == "IsReadOnly" && Reader.NamespaceURI == "") {
1007 					ob.@IsReadOnly = XmlConvert.ToBoolean (Reader.Value);
1008 					ob.IsReadOnlySpecified = true;
1009 				}
1010 				else if (Reader.LocalName == "IsPrimaryKey" && Reader.NamespaceURI == "") {
1011 					ob.@IsPrimaryKey = XmlConvert.ToBoolean (Reader.Value);
1012 					ob.IsPrimaryKeySpecified = true;
1013 				}
1014 				else if (Reader.LocalName == "IsDbGenerated" && Reader.NamespaceURI == "") {
1015 					ob.@IsDbGenerated = XmlConvert.ToBoolean (Reader.Value);
1016 					ob.IsDbGeneratedSpecified = true;
1017 				}
1018 				else if (Reader.LocalName == "CanBeNull" && Reader.NamespaceURI == "") {
1019 					ob.@CanBeNull = XmlConvert.ToBoolean (Reader.Value);
1020 					ob.CanBeNullSpecified = true;
1021 				}
1022 				else if (Reader.LocalName == "UpdateCheck" && Reader.NamespaceURI == "") {
1023 					ob.@UpdateCheck = GetEnumValue_UpdateCheck (Reader.Value);
1024 					ob.UpdateCheckSpecified = true;
1025 				}
1026 				else if (Reader.LocalName == "IsDiscriminator" && Reader.NamespaceURI == "") {
1027 					ob.@IsDiscriminator = XmlConvert.ToBoolean (Reader.Value);
1028 					ob.IsDiscriminatorSpecified = true;
1029 				}
1030 				else if (Reader.LocalName == "Expression" && Reader.NamespaceURI == "") {
1031 					ob.@Expression = Reader.Value;
1032 				}
1033 				else if (Reader.LocalName == "IsVersion" && Reader.NamespaceURI == "") {
1034 					ob.@IsVersion = XmlConvert.ToBoolean (Reader.Value);
1035 					ob.IsVersionSpecified = true;
1036 				}
1037 				else if (Reader.LocalName == "IsDelayLoaded" && Reader.NamespaceURI == "") {
1038 					ob.@IsDelayLoaded = XmlConvert.ToBoolean (Reader.Value);
1039 					ob.IsDelayLoadedSpecified = true;
1040 				}
1041 				else if (Reader.LocalName == "AutoSync" && Reader.NamespaceURI == "") {
1042 					ob.@AutoSync = GetEnumValue_AutoSync (Reader.Value);
1043 					ob.AutoSyncSpecified = true;
1044 				}
1045 				else if (IsXmlnsAttribute (Reader.Name)) {
1046 				}
1047 				else {
1048 					UnknownNode (ob);
1049 				}
1050 			}
1051 
1052 			Reader.MoveToElement ();
1053 			Reader.MoveToElement();
1054 			if (Reader.IsEmptyElement) {
1055 				Reader.Skip ();
1056 				return ob;
1057 			}
1058 
1059 			Reader.ReadStartElement();
1060 			Reader.MoveToContent();
1061 
1062 			while (Reader.NodeType != System.Xml.XmlNodeType.EndElement)
1063 			{
1064 				if (Reader.NodeType == System.Xml.XmlNodeType.Element)
1065 				{
1066 					UnknownNode (ob);
1067 				}
1068 				else
1069 					UnknownNode(ob);
1070 
1071 				Reader.MoveToContent();
1072 			}
1073 
1074 			ReadEndElement();
1075 
1076 			return ob;
1077 		}
1078 
ReadObject_Association(bool isNullable, bool checkType)1079 		public DbLinq.Schema.Dbml.Association ReadObject_Association (bool isNullable, bool checkType)
1080 		{
1081 			DbLinq.Schema.Dbml.Association ob = null;
1082 			if (isNullable && ReadNull()) return null;
1083 
1084 			if (checkType)
1085 			{
1086 				System.Xml.XmlQualifiedName t = GetXsiType();
1087 				if (t == null)
1088 				{ }
1089 				else if (t.Name != "Association" || t.Namespace != "http://schemas.microsoft.com/linqtosql/dbml/2007")
1090 					throw CreateUnknownTypeException(t);
1091 			}
1092 
1093 			ob = (DbLinq.Schema.Dbml.Association) Activator.CreateInstance(typeof(DbLinq.Schema.Dbml.Association), true);
1094 
1095 			Reader.MoveToElement();
1096 
1097 			while (Reader.MoveToNextAttribute())
1098 			{
1099 				if (Reader.LocalName == "Name" && Reader.NamespaceURI == "") {
1100 					ob.@Name = Reader.Value;
1101 				}
1102 				else if (Reader.LocalName == "Member" && Reader.NamespaceURI == "") {
1103 					ob.@Member = Reader.Value;
1104 				}
1105 				else if (Reader.LocalName == "Storage" && Reader.NamespaceURI == "") {
1106 					ob.@Storage = Reader.Value;
1107 				}
1108 				else if (Reader.LocalName == "AccessModifier" && Reader.NamespaceURI == "") {
1109 					ob.@AccessModifier = GetEnumValue_AccessModifier (Reader.Value);
1110 					ob.AccessModifierSpecified = true;
1111 				}
1112 				else if (Reader.LocalName == "Modifier" && Reader.NamespaceURI == "") {
1113 					ob.@Modifier = GetEnumValue_MemberModifier (Reader.Value);
1114 					ob.ModifierSpecified = true;
1115 				}
1116 				else if (Reader.LocalName == "Type" && Reader.NamespaceURI == "") {
1117 					ob.@Type = Reader.Value;
1118 				}
1119 				else if (Reader.LocalName == "ThisKey" && Reader.NamespaceURI == "") {
1120 					ob.@ThisKey = Reader.Value;
1121 				}
1122 				else if (Reader.LocalName == "OtherKey" && Reader.NamespaceURI == "") {
1123 					ob.@OtherKey = Reader.Value;
1124 				}
1125 				else if (Reader.LocalName == "IsForeignKey" && Reader.NamespaceURI == "") {
1126 					ob.@IsForeignKey = XmlConvert.ToBoolean (Reader.Value);
1127 					ob.IsForeignKeySpecified = true;
1128 				}
1129 				else if (Reader.LocalName == "Cardinality" && Reader.NamespaceURI == "") {
1130 					ob.@Cardinality = GetEnumValue_Cardinality (Reader.Value);
1131 					ob.CardinalitySpecified = true;
1132 				}
1133 				else if (Reader.LocalName == "DeleteRule" && Reader.NamespaceURI == "") {
1134 					ob.@DeleteRule = Reader.Value;
1135 				}
1136 				else if (Reader.LocalName == "DeleteOnNull" && Reader.NamespaceURI == "") {
1137 					ob.@DeleteOnNull = XmlConvert.ToBoolean (Reader.Value);
1138 					ob.DeleteOnNullSpecified = true;
1139 				}
1140 				else if (IsXmlnsAttribute (Reader.Name)) {
1141 				}
1142 				else {
1143 					UnknownNode (ob);
1144 				}
1145 			}
1146 
1147 			Reader.MoveToElement ();
1148 			Reader.MoveToElement();
1149 			if (Reader.IsEmptyElement) {
1150 				Reader.Skip ();
1151 				return ob;
1152 			}
1153 
1154 			Reader.ReadStartElement();
1155 			Reader.MoveToContent();
1156 
1157 			while (Reader.NodeType != System.Xml.XmlNodeType.EndElement)
1158 			{
1159 				if (Reader.NodeType == System.Xml.XmlNodeType.Element)
1160 				{
1161 					UnknownNode (ob);
1162 				}
1163 				else
1164 					UnknownNode(ob);
1165 
1166 				Reader.MoveToContent();
1167 			}
1168 
1169 			ReadEndElement();
1170 
1171 			return ob;
1172 		}
1173 
ReadObject_ParameterDirection(bool isNullable, bool checkType)1174 		public DbLinq.Schema.Dbml.ParameterDirection ReadObject_ParameterDirection (bool isNullable, bool checkType)
1175 		{
1176 			Reader.ReadStartElement ();
1177 			DbLinq.Schema.Dbml.ParameterDirection res = GetEnumValue_ParameterDirection (Reader.ReadString());
1178 			if (Reader.NodeType != XmlNodeType.None)
1179 			Reader.ReadEndElement ();
1180 			return res;
1181 		}
1182 
GetEnumValue_ParameterDirection(string xmlName)1183 		DbLinq.Schema.Dbml.ParameterDirection GetEnumValue_ParameterDirection (string xmlName)
1184 		{
1185 			switch (xmlName)
1186 			{
1187 				case "In": return DbLinq.Schema.Dbml.ParameterDirection.In;
1188 				case "Out": return DbLinq.Schema.Dbml.ParameterDirection.Out;
1189 				case "InOut": return DbLinq.Schema.Dbml.ParameterDirection.InOut;
1190 				default:
1191 					throw CreateUnknownConstantException (xmlName, typeof(DbLinq.Schema.Dbml.ParameterDirection));
1192 			}
1193 		}
1194 
ReadObject_Version(bool isNullable, bool checkType)1195 		public DbLinq.Schema.Dbml.Version ReadObject_Version (bool isNullable, bool checkType)
1196 		{
1197 			Reader.ReadStartElement ();
1198 			DbLinq.Schema.Dbml.Version res = GetEnumValue_Version (Reader.ReadString());
1199 			if (Reader.NodeType != XmlNodeType.None)
1200 			Reader.ReadEndElement ();
1201 			return res;
1202 		}
1203 
GetEnumValue_Version(string xmlName)1204 		DbLinq.Schema.Dbml.Version GetEnumValue_Version (string xmlName)
1205 		{
1206 			switch (xmlName)
1207 			{
1208 				case "Current": return DbLinq.Schema.Dbml.Version.Current;
1209 				case "Original": return DbLinq.Schema.Dbml.Version.Original;
1210 				default:
1211 					throw CreateUnknownConstantException (xmlName, typeof(DbLinq.Schema.Dbml.Version));
1212 			}
1213 		}
1214 
ReadObject_UpdateCheck(bool isNullable, bool checkType)1215 		public DbLinq.Schema.Dbml.UpdateCheck ReadObject_UpdateCheck (bool isNullable, bool checkType)
1216 		{
1217 			Reader.ReadStartElement ();
1218 			DbLinq.Schema.Dbml.UpdateCheck res = GetEnumValue_UpdateCheck (Reader.ReadString());
1219 			if (Reader.NodeType != XmlNodeType.None)
1220 			Reader.ReadEndElement ();
1221 			return res;
1222 		}
1223 
GetEnumValue_UpdateCheck(string xmlName)1224 		DbLinq.Schema.Dbml.UpdateCheck GetEnumValue_UpdateCheck (string xmlName)
1225 		{
1226 			switch (xmlName)
1227 			{
1228 				case "Always": return DbLinq.Schema.Dbml.UpdateCheck.Always;
1229 				case "Never": return DbLinq.Schema.Dbml.UpdateCheck.Never;
1230 				case "WhenChanged": return DbLinq.Schema.Dbml.UpdateCheck.WhenChanged;
1231 				default:
1232 					throw CreateUnknownConstantException (xmlName, typeof(DbLinq.Schema.Dbml.UpdateCheck));
1233 			}
1234 		}
1235 
ReadObject_AutoSync(bool isNullable, bool checkType)1236 		public DbLinq.Schema.Dbml.AutoSync ReadObject_AutoSync (bool isNullable, bool checkType)
1237 		{
1238 			Reader.ReadStartElement ();
1239 			DbLinq.Schema.Dbml.AutoSync res = GetEnumValue_AutoSync (Reader.ReadString());
1240 			if (Reader.NodeType != XmlNodeType.None)
1241 			Reader.ReadEndElement ();
1242 			return res;
1243 		}
1244 
GetEnumValue_AutoSync(string xmlName)1245 		DbLinq.Schema.Dbml.AutoSync GetEnumValue_AutoSync (string xmlName)
1246 		{
1247 			switch (xmlName)
1248 			{
1249 				case "Never": return DbLinq.Schema.Dbml.AutoSync.Never;
1250 				case "OnInsert": return DbLinq.Schema.Dbml.AutoSync.OnInsert;
1251 				case "OnUpdate": return DbLinq.Schema.Dbml.AutoSync.OnUpdate;
1252 				case "Always": return DbLinq.Schema.Dbml.AutoSync.Always;
1253 				case "Default": return DbLinq.Schema.Dbml.AutoSync.Default;
1254 				default:
1255 					throw CreateUnknownConstantException (xmlName, typeof(DbLinq.Schema.Dbml.AutoSync));
1256 			}
1257 		}
1258 
ReadObject_Cardinality(bool isNullable, bool checkType)1259 		public DbLinq.Schema.Dbml.Cardinality ReadObject_Cardinality (bool isNullable, bool checkType)
1260 		{
1261 			Reader.ReadStartElement ();
1262 			DbLinq.Schema.Dbml.Cardinality res = GetEnumValue_Cardinality (Reader.ReadString());
1263 			if (Reader.NodeType != XmlNodeType.None)
1264 			Reader.ReadEndElement ();
1265 			return res;
1266 		}
1267 
GetEnumValue_Cardinality(string xmlName)1268 		DbLinq.Schema.Dbml.Cardinality GetEnumValue_Cardinality (string xmlName)
1269 		{
1270 			switch (xmlName)
1271 			{
1272 				case "One": return DbLinq.Schema.Dbml.Cardinality.One;
1273 				case "Many": return DbLinq.Schema.Dbml.Cardinality.Many;
1274 				default:
1275 					throw CreateUnknownConstantException (xmlName, typeof(DbLinq.Schema.Dbml.Cardinality));
1276 			}
1277 		}
1278 
InitCallbacks()1279 		protected override void InitCallbacks ()
1280 		{
1281 		}
1282 
InitIDs()1283 		protected override void InitIDs ()
1284 		{
1285 		}
1286 
1287 	}
1288 
1289 	#if !MONO_STRICT
1290     public
1291     #endif
1292 	class GeneratedWriter : XmlSerializationWriter
1293 	{
1294 		const string xmlNamespace = "http://www.w3.org/2000/xmlns/";
1295 		static readonly System.Reflection.MethodInfo toBinHexStringMethod = typeof (XmlConvert).GetMethod ("ToBinHexString", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic, null, new System.Type [] {typeof (byte [])}, null);
ToBinHexString(byte [] input)1296 		static string ToBinHexString (byte [] input)
1297 		{
1298 			return input == null ? null : (string) toBinHexStringMethod.Invoke (null, new object [] {input});
1299 		}
WriteRoot_Database(object o)1300 		public void WriteRoot_Database (object o)
1301 		{
1302 			WriteStartDocument ();
1303 			DbLinq.Schema.Dbml.Database ob = (DbLinq.Schema.Dbml.Database) o;
1304 			TopLevelElement ();
1305 			WriteObject_Database (ob, "Database", "http://schemas.microsoft.com/linqtosql/dbml/2007", true, false, true);
1306 		}
1307 
WriteObject_Database(DbLinq.Schema.Dbml.Database ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)1308 		void WriteObject_Database (DbLinq.Schema.Dbml.Database ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
1309 		{
1310 			if (((object)ob) == null)
1311 			{
1312 				if (isNullable)
1313 					WriteNullTagLiteral(element, namesp);
1314 				return;
1315 			}
1316 
1317 			System.Type type = ob.GetType ();
1318 			if (type == typeof(DbLinq.Schema.Dbml.Database))
1319 			{ }
1320 			else {
1321 				throw CreateUnknownTypeException (ob);
1322 			}
1323 
1324 			if (writeWrappingElem) {
1325 				WriteStartElement (element, namesp, ob);
1326 			}
1327 
1328 			if (needType) WriteXsiType("Database", "http://schemas.microsoft.com/linqtosql/dbml/2007");
1329 
1330 			WriteAttribute ("Name", "", ob.@Name);
1331 			WriteAttribute ("EntityNamespace", "", ob.@EntityNamespace);
1332 			WriteAttribute ("ContextNamespace", "", ob.@ContextNamespace);
1333 			WriteAttribute ("Class", "", ob.@Class);
1334 			if (ob.@AccessModifierSpecified) {
1335 				WriteAttribute ("AccessModifier", "", GetEnumValue_AccessModifier (ob.@AccessModifier));
1336 			}
1337 			if (ob.@ModifierSpecified) {
1338 				WriteAttribute ("Modifier", "", GetEnumValue_ClassModifier (ob.@Modifier));
1339 			}
1340 			WriteAttribute ("BaseType", "", ob.@BaseType);
1341 			WriteAttribute ("Provider", "", ob.@Provider);
1342 			if (ob.@ExternalMappingSpecified) {
1343 				WriteAttribute ("ExternalMapping", "", (ob.@ExternalMapping?"true":"false"));
1344 			}
1345 			if (ob.@SerializationSpecified) {
1346 				WriteAttribute ("Serialization", "", GetEnumValue_SerializationMode (ob.@Serialization));
1347 			}
1348 			WriteAttribute ("EntityBase", "", ob.@EntityBase);
1349 
1350 			WriteObject_Connection (ob.@Connection, "Connection", "http://schemas.microsoft.com/linqtosql/dbml/2007", false, false, true);
1351 			if (ob.@Table != null) {
1352 				for (int n27 = 0; n27 < ob.@Table.Length; n27++) {
1353 					WriteObject_Table (ob.@Table[n27], "Table", "http://schemas.microsoft.com/linqtosql/dbml/2007", false, false, true);
1354 				}
1355 			}
1356 			if (ob.@Function != null) {
1357 				for (int n28 = 0; n28 < ob.@Function.Length; n28++) {
1358 					WriteObject_Function (ob.@Function[n28], "Function", "http://schemas.microsoft.com/linqtosql/dbml/2007", false, false, true);
1359 				}
1360 			}
1361 			if (writeWrappingElem) WriteEndElement (ob);
1362 		}
1363 
WriteObject_AccessModifier(DbLinq.Schema.Dbml.AccessModifier ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)1364 		void WriteObject_AccessModifier (DbLinq.Schema.Dbml.AccessModifier ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
1365 		{
1366 			System.Type type = ob.GetType ();
1367 			if (type == typeof(DbLinq.Schema.Dbml.AccessModifier))
1368 			{ }
1369 			else {
1370 				throw CreateUnknownTypeException (ob);
1371 			}
1372 
1373 			if (writeWrappingElem) {
1374 				WriteStartElement (element, namesp, ob);
1375 			}
1376 
1377 			if (needType) WriteXsiType("AccessModifier", "http://schemas.microsoft.com/linqtosql/dbml/2007");
1378 
1379 			Writer.WriteString (GetEnumValue_AccessModifier (ob));
1380 			if (writeWrappingElem) WriteEndElement (ob);
1381 		}
1382 
GetEnumValue_AccessModifier(DbLinq.Schema.Dbml.AccessModifier val)1383 		string GetEnumValue_AccessModifier (DbLinq.Schema.Dbml.AccessModifier val)
1384 		{
1385 			switch (val) {
1386 				case DbLinq.Schema.Dbml.AccessModifier.Public: return "Public";
1387 				case DbLinq.Schema.Dbml.AccessModifier.Internal: return "Internal";
1388 				case DbLinq.Schema.Dbml.AccessModifier.Protected: return "Protected";
1389 				case DbLinq.Schema.Dbml.AccessModifier.ProtectedInternal: return "ProtectedInternal";
1390 				case DbLinq.Schema.Dbml.AccessModifier.Private: return "Private";
1391 				default: throw CreateInvalidEnumValueException ((long) val, typeof (DbLinq.Schema.Dbml.AccessModifier).FullName);
1392 			}
1393 		}
1394 
WriteObject_ClassModifier(DbLinq.Schema.Dbml.ClassModifier ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)1395 		void WriteObject_ClassModifier (DbLinq.Schema.Dbml.ClassModifier ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
1396 		{
1397 			System.Type type = ob.GetType ();
1398 			if (type == typeof(DbLinq.Schema.Dbml.ClassModifier))
1399 			{ }
1400 			else {
1401 				throw CreateUnknownTypeException (ob);
1402 			}
1403 
1404 			if (writeWrappingElem) {
1405 				WriteStartElement (element, namesp, ob);
1406 			}
1407 
1408 			if (needType) WriteXsiType("ClassModifier", "http://schemas.microsoft.com/linqtosql/dbml/2007");
1409 
1410 			Writer.WriteString (GetEnumValue_ClassModifier (ob));
1411 			if (writeWrappingElem) WriteEndElement (ob);
1412 		}
1413 
GetEnumValue_ClassModifier(DbLinq.Schema.Dbml.ClassModifier val)1414 		string GetEnumValue_ClassModifier (DbLinq.Schema.Dbml.ClassModifier val)
1415 		{
1416 			switch (val) {
1417 				case DbLinq.Schema.Dbml.ClassModifier.Sealed: return "Sealed";
1418 				case DbLinq.Schema.Dbml.ClassModifier.Abstract: return "Abstract";
1419 				default: throw CreateInvalidEnumValueException ((long) val, typeof (DbLinq.Schema.Dbml.ClassModifier).FullName);
1420 			}
1421 		}
1422 
WriteObject_SerializationMode(DbLinq.Schema.Dbml.SerializationMode ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)1423 		void WriteObject_SerializationMode (DbLinq.Schema.Dbml.SerializationMode ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
1424 		{
1425 			System.Type type = ob.GetType ();
1426 			if (type == typeof(DbLinq.Schema.Dbml.SerializationMode))
1427 			{ }
1428 			else {
1429 				throw CreateUnknownTypeException (ob);
1430 			}
1431 
1432 			if (writeWrappingElem) {
1433 				WriteStartElement (element, namesp, ob);
1434 			}
1435 
1436 			if (needType) WriteXsiType("SerializationMode", "http://schemas.microsoft.com/linqtosql/dbml/2007");
1437 
1438 			Writer.WriteString (GetEnumValue_SerializationMode (ob));
1439 			if (writeWrappingElem) WriteEndElement (ob);
1440 		}
1441 
GetEnumValue_SerializationMode(DbLinq.Schema.Dbml.SerializationMode val)1442 		string GetEnumValue_SerializationMode (DbLinq.Schema.Dbml.SerializationMode val)
1443 		{
1444 			switch (val) {
1445 				case DbLinq.Schema.Dbml.SerializationMode.None: return "None";
1446 				case DbLinq.Schema.Dbml.SerializationMode.Unidirectional: return "Unidirectional";
1447 				default: throw CreateInvalidEnumValueException ((long) val, typeof (DbLinq.Schema.Dbml.SerializationMode).FullName);
1448 			}
1449 		}
1450 
WriteObject_Connection(DbLinq.Schema.Dbml.Connection ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)1451 		void WriteObject_Connection (DbLinq.Schema.Dbml.Connection ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
1452 		{
1453 			if (((object)ob) == null)
1454 			{
1455 				if (isNullable)
1456 					WriteNullTagLiteral(element, namesp);
1457 				return;
1458 			}
1459 
1460 			System.Type type = ob.GetType ();
1461 			if (type == typeof(DbLinq.Schema.Dbml.Connection))
1462 			{ }
1463 			else {
1464 				throw CreateUnknownTypeException (ob);
1465 			}
1466 
1467 			if (writeWrappingElem) {
1468 				WriteStartElement (element, namesp, ob);
1469 			}
1470 
1471 			if (needType) WriteXsiType("Connection", "http://schemas.microsoft.com/linqtosql/dbml/2007");
1472 
1473 			WriteAttribute ("Provider", "", ob.@Provider);
1474 			if (ob.@ModeSpecified) {
1475 				WriteAttribute ("Mode", "", GetEnumValue_ConnectionMode (ob.@Mode));
1476 			}
1477 			WriteAttribute ("ConnectionString", "", ob.@ConnectionString);
1478 			WriteAttribute ("SettingsObjectName", "", ob.@SettingsObjectName);
1479 			WriteAttribute ("SettingsPropertyName", "", ob.@SettingsPropertyName);
1480 
1481 			if (writeWrappingElem) WriteEndElement (ob);
1482 		}
1483 
WriteObject_Table(DbLinq.Schema.Dbml.Table ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)1484 		void WriteObject_Table (DbLinq.Schema.Dbml.Table ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
1485 		{
1486 			if (((object)ob) == null)
1487 			{
1488 				if (isNullable)
1489 					WriteNullTagLiteral(element, namesp);
1490 				return;
1491 			}
1492 
1493 			System.Type type = ob.GetType ();
1494 			if (type == typeof(DbLinq.Schema.Dbml.Table))
1495 			{ }
1496 			else {
1497 				throw CreateUnknownTypeException (ob);
1498 			}
1499 
1500 			if (writeWrappingElem) {
1501 				WriteStartElement (element, namesp, ob);
1502 			}
1503 
1504 			if (needType) WriteXsiType("Table", "http://schemas.microsoft.com/linqtosql/dbml/2007");
1505 
1506 			WriteAttribute ("Name", "", ob.@Name);
1507 			WriteAttribute ("Member", "", ob.@Member);
1508 			if (ob.@AccessModifierSpecified) {
1509 				WriteAttribute ("AccessModifier", "", GetEnumValue_AccessModifier (ob.@AccessModifier));
1510 			}
1511 			if (ob.@ModifierSpecified) {
1512 				WriteAttribute ("Modifier", "", GetEnumValue_MemberModifier (ob.@Modifier));
1513 			}
1514 
1515 			WriteObject_Type (ob.@Type, "Type", "http://schemas.microsoft.com/linqtosql/dbml/2007", false, false, true);
1516 			WriteObject_TableFunction (ob.@InsertFunction, "InsertFunction", "http://schemas.microsoft.com/linqtosql/dbml/2007", false, false, true);
1517 			WriteObject_TableFunction (ob.@UpdateFunction, "UpdateFunction", "http://schemas.microsoft.com/linqtosql/dbml/2007", false, false, true);
1518 			WriteObject_TableFunction (ob.@DeleteFunction, "DeleteFunction", "http://schemas.microsoft.com/linqtosql/dbml/2007", false, false, true);
1519 			if (writeWrappingElem) WriteEndElement (ob);
1520 		}
1521 
WriteObject_Function(DbLinq.Schema.Dbml.Function ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)1522 		void WriteObject_Function (DbLinq.Schema.Dbml.Function ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
1523 		{
1524 			if (((object)ob) == null)
1525 			{
1526 				if (isNullable)
1527 					WriteNullTagLiteral(element, namesp);
1528 				return;
1529 			}
1530 
1531 			System.Type type = ob.GetType ();
1532 			if (type == typeof(DbLinq.Schema.Dbml.Function))
1533 			{ }
1534 			else {
1535 				throw CreateUnknownTypeException (ob);
1536 			}
1537 
1538 			if (writeWrappingElem) {
1539 				WriteStartElement (element, namesp, ob);
1540 			}
1541 
1542 			if (needType) WriteXsiType("Function", "http://schemas.microsoft.com/linqtosql/dbml/2007");
1543 
1544 			WriteAttribute ("Name", "", ob.@Name);
1545 			WriteAttribute ("Id", "", ob.@Id);
1546 			WriteAttribute ("Method", "", ob.@Method);
1547 			if (ob.@AccessModifierSpecified) {
1548 				WriteAttribute ("AccessModifier", "", GetEnumValue_AccessModifier (ob.@AccessModifier));
1549 			}
1550 			if (ob.@ModifierSpecified) {
1551 				WriteAttribute ("Modifier", "", GetEnumValue_MemberModifier (ob.@Modifier));
1552 			}
1553 			if (ob.@HasMultipleResultsSpecified) {
1554 				WriteAttribute ("HasMultipleResults", "", (ob.@HasMultipleResults?"true":"false"));
1555 			}
1556 			if (ob.@IsComposableSpecified) {
1557 				WriteAttribute ("IsComposable", "", (ob.@IsComposable?"true":"false"));
1558 			}
1559 
1560 			if (ob.@Parameter != null) {
1561 				for (int n29 = 0; n29 < ob.@Parameter.Length; n29++) {
1562 					WriteObject_Parameter (ob.@Parameter[n29], "Parameter", "http://schemas.microsoft.com/linqtosql/dbml/2007", false, false, true);
1563 				}
1564 			}
1565 			if (ob.@Items != null) {
1566 				for (int n30 = 0; n30 < ob.@Items.Length; n30++) {
1567 					if (((object)ob.@Items[n30]) == null) { }
1568 					else if (ob.@Items[n30].GetType() == typeof(DbLinq.Schema.Dbml.Return)) {
1569 						WriteObject_Return (((DbLinq.Schema.Dbml.Return) ob.@Items[n30]), "Return", "http://schemas.microsoft.com/linqtosql/dbml/2007", false, false, true);
1570 					}
1571 					else if (ob.@Items[n30].GetType() == typeof(DbLinq.Schema.Dbml.Type)) {
1572 						WriteObject_Type (((DbLinq.Schema.Dbml.Type) ob.@Items[n30]), "ElementType", "http://schemas.microsoft.com/linqtosql/dbml/2007", false, false, true);
1573 					}
1574 					else throw CreateUnknownTypeException (ob.@Items[n30]);
1575 				}
1576 			}
1577 			if (writeWrappingElem) WriteEndElement (ob);
1578 		}
1579 
WriteObject_ConnectionMode(DbLinq.Schema.Dbml.ConnectionMode ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)1580 		void WriteObject_ConnectionMode (DbLinq.Schema.Dbml.ConnectionMode ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
1581 		{
1582 			System.Type type = ob.GetType ();
1583 			if (type == typeof(DbLinq.Schema.Dbml.ConnectionMode))
1584 			{ }
1585 			else {
1586 				throw CreateUnknownTypeException (ob);
1587 			}
1588 
1589 			if (writeWrappingElem) {
1590 				WriteStartElement (element, namesp, ob);
1591 			}
1592 
1593 			if (needType) WriteXsiType("ConnectionMode", "http://schemas.microsoft.com/linqtosql/dbml/2007");
1594 
1595 			Writer.WriteString (GetEnumValue_ConnectionMode (ob));
1596 			if (writeWrappingElem) WriteEndElement (ob);
1597 		}
1598 
GetEnumValue_ConnectionMode(DbLinq.Schema.Dbml.ConnectionMode val)1599 		string GetEnumValue_ConnectionMode (DbLinq.Schema.Dbml.ConnectionMode val)
1600 		{
1601 			switch (val) {
1602 				case DbLinq.Schema.Dbml.ConnectionMode.ConnectionString: return "ConnectionString";
1603 				case DbLinq.Schema.Dbml.ConnectionMode.AppSettings: return "AppSettings";
1604 				case DbLinq.Schema.Dbml.ConnectionMode.WebSettings: return "WebSettings";
1605 				default: throw CreateInvalidEnumValueException ((long) val, typeof (DbLinq.Schema.Dbml.ConnectionMode).FullName);
1606 			}
1607 		}
1608 
WriteObject_MemberModifier(DbLinq.Schema.Dbml.MemberModifier ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)1609 		void WriteObject_MemberModifier (DbLinq.Schema.Dbml.MemberModifier ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
1610 		{
1611 			System.Type type = ob.GetType ();
1612 			if (type == typeof(DbLinq.Schema.Dbml.MemberModifier))
1613 			{ }
1614 			else {
1615 				throw CreateUnknownTypeException (ob);
1616 			}
1617 
1618 			if (writeWrappingElem) {
1619 				WriteStartElement (element, namesp, ob);
1620 			}
1621 
1622 			if (needType) WriteXsiType("MemberModifier", "http://schemas.microsoft.com/linqtosql/dbml/2007");
1623 
1624 			Writer.WriteString (GetEnumValue_MemberModifier (ob));
1625 			if (writeWrappingElem) WriteEndElement (ob);
1626 		}
1627 
GetEnumValue_MemberModifier(DbLinq.Schema.Dbml.MemberModifier val)1628 		string GetEnumValue_MemberModifier (DbLinq.Schema.Dbml.MemberModifier val)
1629 		{
1630 			switch (val) {
1631 				case DbLinq.Schema.Dbml.MemberModifier.Virtual: return "Virtual";
1632 				case DbLinq.Schema.Dbml.MemberModifier.Override: return "Override";
1633 				case DbLinq.Schema.Dbml.MemberModifier.New: return "New";
1634 				case DbLinq.Schema.Dbml.MemberModifier.NewVirtual: return "NewVirtual";
1635 				default: throw CreateInvalidEnumValueException ((long) val, typeof (DbLinq.Schema.Dbml.MemberModifier).FullName);
1636 			}
1637 		}
1638 
WriteObject_Type(DbLinq.Schema.Dbml.Type ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)1639 		void WriteObject_Type (DbLinq.Schema.Dbml.Type ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
1640 		{
1641 			if (((object)ob) == null)
1642 			{
1643 				if (isNullable)
1644 					WriteNullTagLiteral(element, namesp);
1645 				return;
1646 			}
1647 
1648 			System.Type type = ob.GetType ();
1649 			if (type == typeof(DbLinq.Schema.Dbml.Type))
1650 			{ }
1651 			else {
1652 				throw CreateUnknownTypeException (ob);
1653 			}
1654 
1655 			if (writeWrappingElem) {
1656 				WriteStartElement (element, namesp, ob);
1657 			}
1658 
1659 			if (needType) WriteXsiType("Type", "http://schemas.microsoft.com/linqtosql/dbml/2007");
1660 
1661 			WriteAttribute ("IdRef", "", ob.@IdRef);
1662 			WriteAttribute ("Id", "", ob.@Id);
1663 			WriteAttribute ("Name", "", ob.@Name);
1664 			WriteAttribute ("InheritanceCode", "", ob.@InheritanceCode);
1665 			if (ob.@IsInheritanceDefaultSpecified) {
1666 				WriteAttribute ("IsInheritanceDefault", "", (ob.@IsInheritanceDefault?"true":"false"));
1667 			}
1668 			if (ob.@AccessModifierSpecified) {
1669 				WriteAttribute ("AccessModifier", "", GetEnumValue_AccessModifier (ob.@AccessModifier));
1670 			}
1671 			if (ob.@ModifierSpecified) {
1672 				WriteAttribute ("Modifier", "", GetEnumValue_ClassModifier (ob.@Modifier));
1673 			}
1674 
1675 			if (ob.@Items != null) {
1676 				for (int n31 = 0; n31 < ob.@Items.Length; n31++) {
1677 					if (((object)ob.@Items[n31]) == null) { }
1678 					else if (ob.@Items[n31].GetType() == typeof(DbLinq.Schema.Dbml.Column)) {
1679 						WriteObject_Column (((DbLinq.Schema.Dbml.Column) ob.@Items[n31]), "Column", "http://schemas.microsoft.com/linqtosql/dbml/2007", false, false, true);
1680 					}
1681 					else if (ob.@Items[n31].GetType() == typeof(DbLinq.Schema.Dbml.Association)) {
1682 						WriteObject_Association (((DbLinq.Schema.Dbml.Association) ob.@Items[n31]), "Association", "http://schemas.microsoft.com/linqtosql/dbml/2007", false, false, true);
1683 					}
1684 					else throw CreateUnknownTypeException (ob.@Items[n31]);
1685 				}
1686 			}
1687 			if (ob.@Type1 != null) {
1688 				for (int n32 = 0; n32 < ob.@Type1.Length; n32++) {
1689 					WriteObject_Type (ob.@Type1[n32], "Type", "http://schemas.microsoft.com/linqtosql/dbml/2007", false, false, true);
1690 				}
1691 			}
1692 			if (writeWrappingElem) WriteEndElement (ob);
1693 		}
1694 
WriteObject_TableFunction(DbLinq.Schema.Dbml.TableFunction ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)1695 		void WriteObject_TableFunction (DbLinq.Schema.Dbml.TableFunction ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
1696 		{
1697 			if (((object)ob) == null)
1698 			{
1699 				if (isNullable)
1700 					WriteNullTagLiteral(element, namesp);
1701 				return;
1702 			}
1703 
1704 			System.Type type = ob.GetType ();
1705 			if (type == typeof(DbLinq.Schema.Dbml.TableFunction))
1706 			{ }
1707 			else {
1708 				throw CreateUnknownTypeException (ob);
1709 			}
1710 
1711 			if (writeWrappingElem) {
1712 				WriteStartElement (element, namesp, ob);
1713 			}
1714 
1715 			if (needType) WriteXsiType("TableFunction", "http://schemas.microsoft.com/linqtosql/dbml/2007");
1716 
1717 			WriteAttribute ("FunctionId", "", ob.@FunctionId);
1718 			if (ob.@AccessModifierSpecified) {
1719 				WriteAttribute ("AccessModifier", "", GetEnumValue_AccessModifier (ob.@AccessModifier));
1720 			}
1721 
1722 			if (ob.@Argument != null) {
1723 				for (int n33 = 0; n33 < ob.@Argument.Length; n33++) {
1724 					WriteObject_TableFunctionParameter (ob.@Argument[n33], "Argument", "http://schemas.microsoft.com/linqtosql/dbml/2007", false, false, true);
1725 				}
1726 			}
1727 			WriteObject_TableFunctionReturn (ob.@Return, "Return", "http://schemas.microsoft.com/linqtosql/dbml/2007", false, false, true);
1728 			if (writeWrappingElem) WriteEndElement (ob);
1729 		}
1730 
WriteObject_Parameter(DbLinq.Schema.Dbml.Parameter ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)1731 		void WriteObject_Parameter (DbLinq.Schema.Dbml.Parameter ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
1732 		{
1733 			if (((object)ob) == null)
1734 			{
1735 				if (isNullable)
1736 					WriteNullTagLiteral(element, namesp);
1737 				return;
1738 			}
1739 
1740 			System.Type type = ob.GetType ();
1741 			if (type == typeof(DbLinq.Schema.Dbml.Parameter))
1742 			{ }
1743 			else {
1744 				throw CreateUnknownTypeException (ob);
1745 			}
1746 
1747 			if (writeWrappingElem) {
1748 				WriteStartElement (element, namesp, ob);
1749 			}
1750 
1751 			if (needType) WriteXsiType("Parameter", "http://schemas.microsoft.com/linqtosql/dbml/2007");
1752 
1753 			WriteAttribute ("Name", "", ob.@Name);
1754 			WriteAttribute ("Parameter", "", ob.@Parameter1);
1755 			WriteAttribute ("Type", "", ob.@Type);
1756 			WriteAttribute ("DbType", "", ob.@DbType);
1757 			if (ob.@DirectionSpecified) {
1758 				WriteAttribute ("Direction", "", GetEnumValue_ParameterDirection (ob.@Direction));
1759 			}
1760 
1761 			if (writeWrappingElem) WriteEndElement (ob);
1762 		}
1763 
WriteObject_Return(DbLinq.Schema.Dbml.Return ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)1764 		void WriteObject_Return (DbLinq.Schema.Dbml.Return ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
1765 		{
1766 			if (((object)ob) == null)
1767 			{
1768 				if (isNullable)
1769 					WriteNullTagLiteral(element, namesp);
1770 				return;
1771 			}
1772 
1773 			System.Type type = ob.GetType ();
1774 			if (type == typeof(DbLinq.Schema.Dbml.Return))
1775 			{ }
1776 			else {
1777 				throw CreateUnknownTypeException (ob);
1778 			}
1779 
1780 			if (writeWrappingElem) {
1781 				WriteStartElement (element, namesp, ob);
1782 			}
1783 
1784 			if (needType) WriteXsiType("Return", "http://schemas.microsoft.com/linqtosql/dbml/2007");
1785 
1786 			WriteAttribute ("Type", "", ob.@Type);
1787 			WriteAttribute ("DbType", "", ob.@DbType);
1788 
1789 			if (writeWrappingElem) WriteEndElement (ob);
1790 		}
1791 
WriteObject_Column(DbLinq.Schema.Dbml.Column ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)1792 		void WriteObject_Column (DbLinq.Schema.Dbml.Column ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
1793 		{
1794 			if (((object)ob) == null)
1795 			{
1796 				if (isNullable)
1797 					WriteNullTagLiteral(element, namesp);
1798 				return;
1799 			}
1800 
1801 			System.Type type = ob.GetType ();
1802 			if (type == typeof(DbLinq.Schema.Dbml.Column))
1803 			{ }
1804 			else {
1805 				throw CreateUnknownTypeException (ob);
1806 			}
1807 
1808 			if (writeWrappingElem) {
1809 				WriteStartElement (element, namesp, ob);
1810 			}
1811 
1812 			if (needType) WriteXsiType("Column", "http://schemas.microsoft.com/linqtosql/dbml/2007");
1813 
1814 			WriteAttribute ("Name", "", ob.@Name);
1815 			WriteAttribute ("Member", "", ob.@Member);
1816 			WriteAttribute ("Storage", "", ob.@Storage);
1817 			if (ob.@AccessModifierSpecified) {
1818 				WriteAttribute ("AccessModifier", "", GetEnumValue_AccessModifier (ob.@AccessModifier));
1819 			}
1820 			if (ob.@ModifierSpecified) {
1821 				WriteAttribute ("Modifier", "", GetEnumValue_MemberModifier (ob.@Modifier));
1822 			}
1823 			WriteAttribute ("Type", "", ob.@Type);
1824 			WriteAttribute ("DbType", "", ob.@DbType);
1825 			if (ob.@IsReadOnlySpecified) {
1826 				WriteAttribute ("IsReadOnly", "", (ob.@IsReadOnly?"true":"false"));
1827 			}
1828 			if (ob.@IsPrimaryKeySpecified) {
1829 				WriteAttribute ("IsPrimaryKey", "", (ob.@IsPrimaryKey?"true":"false"));
1830 			}
1831 			if (ob.@IsDbGeneratedSpecified) {
1832 				WriteAttribute ("IsDbGenerated", "", (ob.@IsDbGenerated?"true":"false"));
1833 			}
1834 			if (ob.@CanBeNullSpecified) {
1835 				WriteAttribute ("CanBeNull", "", (ob.@CanBeNull?"true":"false"));
1836 			}
1837 			if (ob.@UpdateCheckSpecified) {
1838 				WriteAttribute ("UpdateCheck", "", GetEnumValue_UpdateCheck (ob.@UpdateCheck));
1839 			}
1840 			if (ob.@IsDiscriminatorSpecified) {
1841 				WriteAttribute ("IsDiscriminator", "", (ob.@IsDiscriminator?"true":"false"));
1842 			}
1843 			WriteAttribute ("Expression", "", ob.@Expression);
1844 			if (ob.@IsVersionSpecified) {
1845 				WriteAttribute ("IsVersion", "", (ob.@IsVersion?"true":"false"));
1846 			}
1847 			if (ob.@IsDelayLoadedSpecified) {
1848 				WriteAttribute ("IsDelayLoaded", "", (ob.@IsDelayLoaded?"true":"false"));
1849 			}
1850 			if (ob.@AutoSyncSpecified) {
1851 				WriteAttribute ("AutoSync", "", GetEnumValue_AutoSync (ob.@AutoSync));
1852 			}
1853 
1854 			if (writeWrappingElem) WriteEndElement (ob);
1855 		}
1856 
WriteObject_Association(DbLinq.Schema.Dbml.Association ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)1857 		void WriteObject_Association (DbLinq.Schema.Dbml.Association ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
1858 		{
1859 			if (((object)ob) == null)
1860 			{
1861 				if (isNullable)
1862 					WriteNullTagLiteral(element, namesp);
1863 				return;
1864 			}
1865 
1866 			System.Type type = ob.GetType ();
1867 			if (type == typeof(DbLinq.Schema.Dbml.Association))
1868 			{ }
1869 			else {
1870 				throw CreateUnknownTypeException (ob);
1871 			}
1872 
1873 			if (writeWrappingElem) {
1874 				WriteStartElement (element, namesp, ob);
1875 			}
1876 
1877 			if (needType) WriteXsiType("Association", "http://schemas.microsoft.com/linqtosql/dbml/2007");
1878 
1879 			WriteAttribute ("Name", "", ob.@Name);
1880 			WriteAttribute ("Member", "", ob.@Member);
1881 			WriteAttribute ("Storage", "", ob.@Storage);
1882 			if (ob.@AccessModifierSpecified) {
1883 				WriteAttribute ("AccessModifier", "", GetEnumValue_AccessModifier (ob.@AccessModifier));
1884 			}
1885 			if (ob.@ModifierSpecified) {
1886 				WriteAttribute ("Modifier", "", GetEnumValue_MemberModifier (ob.@Modifier));
1887 			}
1888 			WriteAttribute ("Type", "", ob.@Type);
1889 			WriteAttribute ("ThisKey", "", ob.@ThisKey);
1890 			WriteAttribute ("OtherKey", "", ob.@OtherKey);
1891 			if (ob.@IsForeignKeySpecified) {
1892 				WriteAttribute ("IsForeignKey", "", (ob.@IsForeignKey?"true":"false"));
1893 			}
1894 			if (ob.@CardinalitySpecified) {
1895 				WriteAttribute ("Cardinality", "", GetEnumValue_Cardinality (ob.@Cardinality));
1896 			}
1897 			WriteAttribute ("DeleteRule", "", ob.@DeleteRule);
1898 			if (ob.@DeleteOnNullSpecified) {
1899 				WriteAttribute ("DeleteOnNull", "", (ob.@DeleteOnNull?"true":"false"));
1900 			}
1901 
1902 			if (writeWrappingElem) WriteEndElement (ob);
1903 		}
1904 
WriteObject_TableFunctionParameter(DbLinq.Schema.Dbml.TableFunctionParameter ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)1905 		void WriteObject_TableFunctionParameter (DbLinq.Schema.Dbml.TableFunctionParameter ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
1906 		{
1907 			if (((object)ob) == null)
1908 			{
1909 				if (isNullable)
1910 					WriteNullTagLiteral(element, namesp);
1911 				return;
1912 			}
1913 
1914 			System.Type type = ob.GetType ();
1915 			if (type == typeof(DbLinq.Schema.Dbml.TableFunctionParameter))
1916 			{ }
1917 			else {
1918 				throw CreateUnknownTypeException (ob);
1919 			}
1920 
1921 			if (writeWrappingElem) {
1922 				WriteStartElement (element, namesp, ob);
1923 			}
1924 
1925 			if (needType) WriteXsiType("TableFunctionParameter", "http://schemas.microsoft.com/linqtosql/dbml/2007");
1926 
1927 			WriteAttribute ("Parameter", "", ob.@Parameter);
1928 			WriteAttribute ("Member", "", ob.@Member);
1929 			if (ob.@VersionSpecified) {
1930 				WriteAttribute ("Version", "", GetEnumValue_Version (ob.@Version));
1931 			}
1932 
1933 			if (writeWrappingElem) WriteEndElement (ob);
1934 		}
1935 
WriteObject_TableFunctionReturn(DbLinq.Schema.Dbml.TableFunctionReturn ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)1936 		void WriteObject_TableFunctionReturn (DbLinq.Schema.Dbml.TableFunctionReturn ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
1937 		{
1938 			if (((object)ob) == null)
1939 			{
1940 				if (isNullable)
1941 					WriteNullTagLiteral(element, namesp);
1942 				return;
1943 			}
1944 
1945 			System.Type type = ob.GetType ();
1946 			if (type == typeof(DbLinq.Schema.Dbml.TableFunctionReturn))
1947 			{ }
1948 			else {
1949 				throw CreateUnknownTypeException (ob);
1950 			}
1951 
1952 			if (writeWrappingElem) {
1953 				WriteStartElement (element, namesp, ob);
1954 			}
1955 
1956 			if (needType) WriteXsiType("TableFunctionReturn", "http://schemas.microsoft.com/linqtosql/dbml/2007");
1957 
1958 			WriteAttribute ("Member", "", ob.@Member);
1959 
1960 			if (writeWrappingElem) WriteEndElement (ob);
1961 		}
1962 
WriteObject_ParameterDirection(DbLinq.Schema.Dbml.ParameterDirection ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)1963 		void WriteObject_ParameterDirection (DbLinq.Schema.Dbml.ParameterDirection ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
1964 		{
1965 			System.Type type = ob.GetType ();
1966 			if (type == typeof(DbLinq.Schema.Dbml.ParameterDirection))
1967 			{ }
1968 			else {
1969 				throw CreateUnknownTypeException (ob);
1970 			}
1971 
1972 			if (writeWrappingElem) {
1973 				WriteStartElement (element, namesp, ob);
1974 			}
1975 
1976 			if (needType) WriteXsiType("ParameterDirection", "http://schemas.microsoft.com/linqtosql/dbml/2007");
1977 
1978 			Writer.WriteString (GetEnumValue_ParameterDirection (ob));
1979 			if (writeWrappingElem) WriteEndElement (ob);
1980 		}
1981 
GetEnumValue_ParameterDirection(DbLinq.Schema.Dbml.ParameterDirection val)1982 		string GetEnumValue_ParameterDirection (DbLinq.Schema.Dbml.ParameterDirection val)
1983 		{
1984 			switch (val) {
1985 				case DbLinq.Schema.Dbml.ParameterDirection.In: return "In";
1986 				case DbLinq.Schema.Dbml.ParameterDirection.Out: return "Out";
1987 				case DbLinq.Schema.Dbml.ParameterDirection.InOut: return "InOut";
1988 				default: throw CreateInvalidEnumValueException ((long) val, typeof (DbLinq.Schema.Dbml.ParameterDirection).FullName);
1989 			}
1990 		}
1991 
WriteObject_UpdateCheck(DbLinq.Schema.Dbml.UpdateCheck ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)1992 		void WriteObject_UpdateCheck (DbLinq.Schema.Dbml.UpdateCheck ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
1993 		{
1994 			System.Type type = ob.GetType ();
1995 			if (type == typeof(DbLinq.Schema.Dbml.UpdateCheck))
1996 			{ }
1997 			else {
1998 				throw CreateUnknownTypeException (ob);
1999 			}
2000 
2001 			if (writeWrappingElem) {
2002 				WriteStartElement (element, namesp, ob);
2003 			}
2004 
2005 			if (needType) WriteXsiType("UpdateCheck", "http://schemas.microsoft.com/linqtosql/dbml/2007");
2006 
2007 			Writer.WriteString (GetEnumValue_UpdateCheck (ob));
2008 			if (writeWrappingElem) WriteEndElement (ob);
2009 		}
2010 
GetEnumValue_UpdateCheck(DbLinq.Schema.Dbml.UpdateCheck val)2011 		string GetEnumValue_UpdateCheck (DbLinq.Schema.Dbml.UpdateCheck val)
2012 		{
2013 			switch (val) {
2014 				case DbLinq.Schema.Dbml.UpdateCheck.Always: return "Always";
2015 				case DbLinq.Schema.Dbml.UpdateCheck.Never: return "Never";
2016 				case DbLinq.Schema.Dbml.UpdateCheck.WhenChanged: return "WhenChanged";
2017 				default: throw CreateInvalidEnumValueException ((long) val, typeof (DbLinq.Schema.Dbml.UpdateCheck).FullName);
2018 			}
2019 		}
2020 
WriteObject_AutoSync(DbLinq.Schema.Dbml.AutoSync ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)2021 		void WriteObject_AutoSync (DbLinq.Schema.Dbml.AutoSync ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
2022 		{
2023 			System.Type type = ob.GetType ();
2024 			if (type == typeof(DbLinq.Schema.Dbml.AutoSync))
2025 			{ }
2026 			else {
2027 				throw CreateUnknownTypeException (ob);
2028 			}
2029 
2030 			if (writeWrappingElem) {
2031 				WriteStartElement (element, namesp, ob);
2032 			}
2033 
2034 			if (needType) WriteXsiType("AutoSync", "http://schemas.microsoft.com/linqtosql/dbml/2007");
2035 
2036 			Writer.WriteString (GetEnumValue_AutoSync (ob));
2037 			if (writeWrappingElem) WriteEndElement (ob);
2038 		}
2039 
GetEnumValue_AutoSync(DbLinq.Schema.Dbml.AutoSync val)2040 		string GetEnumValue_AutoSync (DbLinq.Schema.Dbml.AutoSync val)
2041 		{
2042 			switch (val) {
2043 				case DbLinq.Schema.Dbml.AutoSync.Never: return "Never";
2044 				case DbLinq.Schema.Dbml.AutoSync.OnInsert: return "OnInsert";
2045 				case DbLinq.Schema.Dbml.AutoSync.OnUpdate: return "OnUpdate";
2046 				case DbLinq.Schema.Dbml.AutoSync.Always: return "Always";
2047 				case DbLinq.Schema.Dbml.AutoSync.Default: return "Default";
2048 				default: throw CreateInvalidEnumValueException ((long) val, typeof (DbLinq.Schema.Dbml.AutoSync).FullName);
2049 			}
2050 		}
2051 
WriteObject_Cardinality(DbLinq.Schema.Dbml.Cardinality ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)2052 		void WriteObject_Cardinality (DbLinq.Schema.Dbml.Cardinality ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
2053 		{
2054 			System.Type type = ob.GetType ();
2055 			if (type == typeof(DbLinq.Schema.Dbml.Cardinality))
2056 			{ }
2057 			else {
2058 				throw CreateUnknownTypeException (ob);
2059 			}
2060 
2061 			if (writeWrappingElem) {
2062 				WriteStartElement (element, namesp, ob);
2063 			}
2064 
2065 			if (needType) WriteXsiType("Cardinality", "http://schemas.microsoft.com/linqtosql/dbml/2007");
2066 
2067 			Writer.WriteString (GetEnumValue_Cardinality (ob));
2068 			if (writeWrappingElem) WriteEndElement (ob);
2069 		}
2070 
GetEnumValue_Cardinality(DbLinq.Schema.Dbml.Cardinality val)2071 		string GetEnumValue_Cardinality (DbLinq.Schema.Dbml.Cardinality val)
2072 		{
2073 			switch (val) {
2074 				case DbLinq.Schema.Dbml.Cardinality.One: return "One";
2075 				case DbLinq.Schema.Dbml.Cardinality.Many: return "Many";
2076 				default: throw CreateInvalidEnumValueException ((long) val, typeof (DbLinq.Schema.Dbml.Cardinality).FullName);
2077 			}
2078 		}
2079 
WriteObject_Version(DbLinq.Schema.Dbml.Version ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)2080 		void WriteObject_Version (DbLinq.Schema.Dbml.Version ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
2081 		{
2082 			System.Type type = ob.GetType ();
2083 			if (type == typeof(DbLinq.Schema.Dbml.Version))
2084 			{ }
2085 			else {
2086 				throw CreateUnknownTypeException (ob);
2087 			}
2088 
2089 			if (writeWrappingElem) {
2090 				WriteStartElement (element, namesp, ob);
2091 			}
2092 
2093 			if (needType) WriteXsiType("Version", "http://schemas.microsoft.com/linqtosql/dbml/2007");
2094 
2095 			Writer.WriteString (GetEnumValue_Version (ob));
2096 			if (writeWrappingElem) WriteEndElement (ob);
2097 		}
2098 
GetEnumValue_Version(DbLinq.Schema.Dbml.Version val)2099 		string GetEnumValue_Version (DbLinq.Schema.Dbml.Version val)
2100 		{
2101 			switch (val) {
2102 				case DbLinq.Schema.Dbml.Version.Current: return "Current";
2103 				case DbLinq.Schema.Dbml.Version.Original: return "Original";
2104 				default: throw CreateInvalidEnumValueException ((long) val, typeof (DbLinq.Schema.Dbml.Version).FullName);
2105 			}
2106 		}
2107 
InitCallbacks()2108 		protected override void InitCallbacks ()
2109 		{
2110 		}
2111 
2112 	}
2113 
2114 
2115 	#if !MONO_STRICT
2116     public
2117       #endif
2118 	class BaseXmlSerializer : System.Xml.Serialization.XmlSerializer
2119 	{
CreateReader()2120 		protected override System.Xml.Serialization.XmlSerializationReader CreateReader () {
2121 			return new GeneratedReader ();
2122 		}
2123 
CreateWriter()2124 		protected override System.Xml.Serialization.XmlSerializationWriter CreateWriter () {
2125 			return new GeneratedWriter ();
2126 		}
2127 
CanDeserialize(System.Xml.XmlReader xmlReader)2128 		public override bool CanDeserialize (System.Xml.XmlReader xmlReader) {
2129 			return true;
2130 		}
2131 	}
2132 
2133     #if !MONO_STRICT
2134     public
2135     #endif
2136 	sealed class DatabaseSerializer : BaseXmlSerializer
2137 	{
Serialize(object obj, System.Xml.Serialization.XmlSerializationWriter writer)2138 		protected override void Serialize (object obj, System.Xml.Serialization.XmlSerializationWriter writer) {
2139 			((GeneratedWriter)writer).WriteRoot_Database(obj);
2140 		}
2141 
Deserialize(System.Xml.Serialization.XmlSerializationReader reader)2142 		protected override object Deserialize (System.Xml.Serialization.XmlSerializationReader reader) {
2143 			return ((GeneratedReader)reader).ReadRoot_Database();
2144 		}
2145 	}
2146 
2147 	#if !MONO_STRICT
2148     public
2149     #endif
2150 	class XmlSerializerContract : System.Xml.Serialization.XmlSerializerImplementation
2151 	{
2152 		System.Collections.Hashtable readMethods = null;
2153 		System.Collections.Hashtable writeMethods = null;
2154 		System.Collections.Hashtable typedSerializers = null;
2155 
2156 		public override System.Xml.Serialization.XmlSerializationReader Reader {
2157 			get {
2158 				return new GeneratedReader();
2159 			}
2160 		}
2161 
2162 		public override System.Xml.Serialization.XmlSerializationWriter Writer {
2163 			get {
2164 				return new GeneratedWriter();
2165 			}
2166 		}
2167 
2168 		public override System.Collections.Hashtable ReadMethods {
2169 			get {
2170 				lock (this) {
2171 					if (readMethods == null) {
2172 						readMethods = new System.Collections.Hashtable ();
2173 						readMethods.Add (@"DbLinq.Schema.Dbml.Database", @"ReadRoot_Database");
2174 					}
2175 					return readMethods;
2176 				}
2177 			}
2178 		}
2179 
2180 		public override System.Collections.Hashtable WriteMethods {
2181 			get {
2182 				lock (this) {
2183 					if (writeMethods == null) {
2184 						writeMethods = new System.Collections.Hashtable ();
2185 						writeMethods.Add (@"DbLinq.Schema.Dbml.Database", @"WriteRoot_Database");
2186 					}
2187 					return writeMethods;
2188 				}
2189 			}
2190 		}
2191 
2192 		public override System.Collections.Hashtable TypedSerializers {
2193 			get {
2194 				lock (this) {
2195 					if (typedSerializers == null) {
2196 						typedSerializers = new System.Collections.Hashtable ();
2197 						typedSerializers.Add (@"DbLinq.Schema.Dbml.Database", new DatabaseSerializer());
2198 					}
2199 					return typedSerializers;
2200 				}
2201 			}
2202 		}
2203 
GetSerializer(System.Type type)2204 		public XmlSerializer GetSerializer (System.Type type)
2205 		{
2206 			switch (type.FullName) {
2207 			case "DbLinq.Schema.Dbml.Database":
2208 				return (XmlSerializer) TypedSerializers ["DbLinq.Schema.Dbml.Database"];
2209 
2210 			}
2211 			return base.GetSerializer (type);
2212 		}
2213 
CanSerialize(System.Type type)2214 		public override bool CanSerialize (System.Type type) {
2215 			if (type == typeof(DbLinq.Schema.Dbml.Database)) return true;
2216 			return false;
2217 		}
2218 	}
2219 
2220 }
2221 
2222