Fix spelling
[mono.git] / mcs / class / System.Data / Test / System.Data / DataSetTypedDataSetTest.cs
1 // Authors:
2 //   Rafael Mizrahi   <rafim@mainsoft.com>
3 //   Erez Lotan       <erezl@mainsoft.com>
4 //   Oren Gurfinkel   <oreng@mainsoft.com>
5 //   Ofer Borstein
6 //
7 // Copyright (c) 2004 Mainsoft Co.
8 //
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
16 //
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
19 //
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 //
28
29 using NUnit.Framework;
30 using System;
31 using System.ComponentModel;
32 using System.Data;
33 using MonoTests.System.Data.Utils;
34 using System.Collections;
35 using System.Runtime.Serialization;
36 using System.Xml;
37 using System.Xml.Schema;
38 using System.IO;
39 using System.Globalization;
40
41 namespace MonoTests.System.Data
42 {
43         [TestFixture]
44         public class DataSetTypedDataSetTest
45         {
46                 private string EventStatus = string.Empty ;
47
48                 [Test]
49                 public void TypedDataSet()
50                 {
51                         int i = 0;
52                         //check dataset constructor
53                         myTypedDataSet ds = null;
54                         DataSet unTypedDs = new DataSet();
55                         ds = new myTypedDataSet();
56                         Assert.IsFalse(ds == null ,"TDS0" );
57                         Assert.AreEqual(typeof(myTypedDataSet), ds.GetType() ,"TDS1" );
58                 
59                         // fill dataset
60                         ds.ReadXml("Test/System.Data/TypedDataSet.xml");
61
62                         // check DataSet named property "Orders"
63                         myTypedDataSet.OrdersDataTable tblOrders = null;
64                         tblOrders = ds.Orders; 
65                         Assert.AreEqual(ds.Tables["Orders"],tblOrders ,"TDS2");
66                         
67                         //check DataSet named property Orders - by index");
68                         tblOrders = ds.Orders; 
69                         Assert.AreEqual(ds.Tables[1],tblOrders ,"TDS3");
70                         
71                         //add new row AddTableNameRow, check row count");
72                         i = tblOrders.Rows.Count;
73                         tblOrders.AddOrdersRow("SAVEA",1,new DateTime(1998,05,01,00,00,00,000)
74                                 ,new DateTime(1998,05,29,00,00,00,000)
75                                 ,new DateTime(1998,05,04,00,00,00,000),1,30.0900m
76                                 ,"Save-a-lot Markets","187 Suffolk Ln.","Boise","ID","83720","USA");
77                         Assert.AreEqual(i+1 ,tblOrders.Rows.Count,"TDS5");
78                 
79                         //check the new row AutoIncrement field - AddTableNameRow
80                         i = (int)tblOrders.Rows[tblOrders.Rows.Count-2][0];
81                         Assert.AreEqual(i+1 ,(int)tblOrders.Rows[tblOrders.Rows.Count-1][0],"TDS6");
82
83                         //Create New Row using NewTableNameRow, check row != null
84                         myTypedDataSet.OrdersRow drOrders = null;
85                         drOrders = tblOrders.NewOrdersRow();
86                         Assert.IsFalse(drOrders == null ,"TDS7");
87                         
88                         //Create New Row using NewTableNameRow, check row state
89                         Assert.AreEqual(DataRowState.Detached, drOrders.RowState ,  "TDS8");
90
91                         //add new row NewTableNameRow, check row count
92                         //drOrders.OrderID = DBNull.Value;
93                         drOrders.CustomerID = "GREAL";
94                         drOrders.EmployeeID = 4;
95                         drOrders.OrderDate = new DateTime(1998,04,30,00,00,00,000);
96                         drOrders.RequiredDate = new DateTime(1998,06,11,00,00,00,000);
97                         drOrders["ShippedDate"] = DBNull.Value; 
98                         drOrders.ShipVia = 3;
99                         drOrders.Freight = 14.0100m;
100                         drOrders.ShipName = "Great Lakes";
101                         drOrders.ShipAddress = "Food Market";
102                         drOrders.ShipCity = "Baker Blvd.";
103                         drOrders.ShipRegion = "Eugene";
104                         drOrders.ShipPostalCode = "OR   97403";
105                         drOrders.ShipCountry =  "USA";
106
107                         i = tblOrders.Rows.Count;
108                         tblOrders.AddOrdersRow(drOrders);
109                         Assert.AreEqual(i+1 ,tblOrders.Rows.Count,"TDS9");
110
111                         //check StrongTypingException
112                         try
113                         {
114                                 DateTime d = drOrders.ShippedDate; //drOrders.ShippedDate = null, will raise exception
115                                 Assert.Fail("TDS10: Failed to throw StrongTypingException");
116                         }
117                         catch (StrongTypingException) {}
118                         catch (AssertionException exc) {throw  exc;}
119                         catch (Exception exc)
120                         {
121                                 Assert.Fail("TDS11: Wrong exception type. Got:" + exc);
122                         }
123                 
124                         //check the new row AutoIncrement field - NewTableNameRow
125                         i = (int)tblOrders.Rows[tblOrders.Rows.Count-2][0];
126                         Assert.AreEqual(i+1 ,(int)tblOrders.Rows[tblOrders.Rows.Count-1][0],"TDS12");
127
128                         // convenience IsNull functions
129                         // only if it can be null
130                         Assert.IsFalse(drOrders.IsShipAddressNull() ,"TDS13");
131                         
132                         drOrders.SetShipAddressNull(); 
133                         Assert.IsTrue(drOrders.IsShipAddressNull() ,"TDS14");
134                         
135                         // Table exposes a public property Count == table.Rows.Count
136                         Assert.AreEqual(tblOrders.Count ,tblOrders.Rows.Count , "TDS15");
137
138
139                         // find function
140                         myTypedDataSet.OrdersRow dr = tblOrders[0];
141                         Assert.AreEqual(tblOrders.FindByOrderID(dr.OrderID),dr,"TDS16" );
142
143                         //Remove row and check row count
144                         i = tblOrders.Count; 
145                         myTypedDataSet.OrdersRow drr = tblOrders[0];
146                         tblOrders.RemoveOrdersRow(drr);
147                         Assert.AreEqual(i-1 ,tblOrders.Count,"TDS17");
148
149                         //first column is readonly
150                         Assert.IsTrue(tblOrders.OrderIDColumn.ReadOnly  ,"TDS18");
151
152                         //read only exception
153                         try
154                         {
155                                 tblOrders[0].OrderID = 99;
156                                 Assert.Fail("TDS19: Failed to throw ReadOnlyException");
157                         }
158                         catch (ReadOnlyException) {}
159                         catch (AssertionException exc) {throw  exc;}
160                         catch (Exception exc)
161                         {
162                                 Assert.Fail("TDS20: Wrong exception type. Got:" + exc);
163                         }
164
165                         tblOrders.AcceptChanges();
166
167                         //Check table events
168                         // add event handlers
169                         ds.Orders.OrdersRowChanging += new myTypedDataSet.OrdersRowChangeEventHandler(T_Changing);
170                         ds.Orders.OrdersRowChanged += new myTypedDataSet.OrdersRowChangeEventHandler(T_Changed);
171                         ds.Orders.OrdersRowDeleting += new myTypedDataSet.OrdersRowChangeEventHandler(T_Deleting);
172                         ds.Orders.OrdersRowDeleted += new myTypedDataSet.OrdersRowChangeEventHandler(T_Deleted);
173         
174                         //RowChange event order
175                         tblOrders[0].ShipCity = "Tel Aviv";
176                         Assert.AreEqual("AB",EventStatus  , "TDS21");
177
178                         EventStatus = string.Empty; 
179                         //RowDelet event order
180                         tblOrders[0].Delete(); 
181                         Assert.AreEqual("AB",EventStatus  , "TDS22");
182
183                         //expose DataColumn as property
184                         Assert.AreEqual(ds.Orders.OrderIDColumn ,ds.Tables["Orders"].Columns["OrderID"],"TDS23");
185                 
186                         //Accept changes for all deleted and changedd rows.
187                         ds.AcceptChanges();
188
189                         //check relations
190                         //ChildTableRow has property ParentTableRow
191                         myTypedDataSet.OrdersRow dr1 = ds.Order_Details[0].OrdersRow;
192                         DataRow dr2 = ds.Order_Details[0].GetParentRow(ds.Relations[0]);
193                         Assert.AreEqual(dr1 ,dr2 ,"TDS24");
194                         
195                         //ParentTableRow has property ChildTableRow
196                         myTypedDataSet.Order_DetailsRow[] drArr1 = ds.Orders[0].GetOrder_DetailsRows();
197                         DataRow[] drArr2 = ds.Orders[0].GetChildRows(ds.Relations[0]);
198                         Assert.AreEqual(drArr1 ,drArr2,"TDS25");
199                 }
200         
201                 protected void T_Changing(object sender, myTypedDataSet.OrdersRowChangeEvent e) 
202                 { 
203                         EventStatus += "A";             
204                 }
205
206                 protected void T_Changed(object sender, myTypedDataSet.OrdersRowChangeEvent e) 
207                 { 
208                         EventStatus += "B";
209                 }
210
211                 protected void T_Deleting(object sender, myTypedDataSet.OrdersRowChangeEvent e) 
212                 { 
213                         EventStatus += "A";
214                 }
215
216                 protected void T_Deleted(object sender, myTypedDataSet.OrdersRowChangeEvent e) 
217                 { 
218                         EventStatus += "B";
219                 }
220
221                 [Serializable()]
222                 [DesignerCategoryAttribute("code")]
223                 [ToolboxItem(true)]
224                 public class myTypedDataSet : DataSet 
225                 {        
226                         private Order_DetailsDataTable tableOrder_Details;
227         
228                         private OrdersDataTable tableOrders;
229         
230                         private DataRelation relationOrdersOrder_x0020_Details;
231         
232                         public myTypedDataSet() 
233                         {
234                                 this.InitClass();
235                                 CollectionChangeEventHandler schemaChangedHandler = new CollectionChangeEventHandler(this.SchemaChanged);
236                                 this.Tables.CollectionChanged += schemaChangedHandler;
237                                 this.Relations.CollectionChanged += schemaChangedHandler;
238                         }
239         
240                         protected myTypedDataSet(SerializationInfo info, StreamingContext context) 
241                         {
242                                 string strSchema = ((string)(info.GetValue("XmlSchema", typeof(string))));
243                                 if ((strSchema != null)) 
244                                 {
245                                         DataSet ds = new DataSet();
246                                         ds.ReadXmlSchema(new XmlTextReader(new StringReader(strSchema)));
247                                         if ((ds.Tables["Order Details"] != null)) 
248                                         {
249                                                 this.Tables.Add(new Order_DetailsDataTable(ds.Tables["Order Details"]));
250                                         }
251                                         if ((ds.Tables["Orders"] != null)) 
252                                         {
253                                                 this.Tables.Add(new OrdersDataTable(ds.Tables["Orders"]));
254                                         }
255                                         this.DataSetName = ds.DataSetName;
256                                         this.Prefix = ds.Prefix;
257                                         this.Namespace = ds.Namespace;
258                                         this.Locale = ds.Locale;
259                                         this.CaseSensitive = ds.CaseSensitive;
260                                         this.EnforceConstraints = ds.EnforceConstraints;
261                                         this.Merge(ds, false, MissingSchemaAction.Add);
262                                         this.InitVars();
263                                 }
264                                 else 
265                                 {
266                                         this.InitClass();
267                                 }
268                                 this.GetSerializationData(info, context);
269                                 CollectionChangeEventHandler schemaChangedHandler = new CollectionChangeEventHandler(this.SchemaChanged);
270                                 this.Tables.CollectionChanged += schemaChangedHandler;
271                                 this.Relations.CollectionChanged += schemaChangedHandler;
272                         }
273         
274                         [Browsable(false)]
275                         [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Content)]
276                         public Order_DetailsDataTable Order_Details 
277                         {
278                                 get 
279                                 {
280                                         return this.tableOrder_Details;
281                                 }
282                         }
283         
284                         [Browsable(false)]
285                         [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Content)]
286                         public OrdersDataTable Orders 
287                         {
288                                 get 
289                                 {
290                                         return this.tableOrders;
291                                 }
292                         }
293         
294                         public override DataSet Clone() 
295                         {
296                                 myTypedDataSet cln = ((myTypedDataSet)(base.Clone()));
297                                 cln.InitVars();
298                                 return cln;
299                         }
300         
301                         protected override bool ShouldSerializeTables() 
302                         {
303                                 return false;
304                         }
305         
306                         protected override bool ShouldSerializeRelations() 
307                         {
308                                 return false;
309                         }
310         
311                         protected override void ReadXmlSerializable(XmlReader reader) 
312                         {
313                                 this.Reset();
314                                 DataSet ds = new DataSet();
315                                 ds.ReadXml(reader);
316                                 if ((ds.Tables["Order Details"] != null)) 
317                                 {
318                                         this.Tables.Add(new Order_DetailsDataTable(ds.Tables["Order Details"]));
319                                 }
320                                 if ((ds.Tables["Orders"] != null)) 
321                                 {
322                                         this.Tables.Add(new OrdersDataTable(ds.Tables["Orders"]));
323                                 }
324                                 this.DataSetName = ds.DataSetName;
325                                 this.Prefix = ds.Prefix;
326                                 this.Namespace = ds.Namespace;
327                                 this.Locale = ds.Locale;
328                                 this.CaseSensitive = ds.CaseSensitive;
329                                 this.EnforceConstraints = ds.EnforceConstraints;
330                                 this.Merge(ds, false, MissingSchemaAction.Add);
331                                 this.InitVars();
332                         }
333         
334                         protected override XmlSchema GetSchemaSerializable() 
335                         {
336                                 MemoryStream stream = new MemoryStream();
337                                 this.WriteXmlSchema(new XmlTextWriter(stream, null));
338                                 stream.Position = 0;
339                                 return XmlSchema.Read(new XmlTextReader(stream), null);
340                         }
341         
342                         internal void InitVars() 
343                         {
344                                 this.tableOrder_Details = ((Order_DetailsDataTable)(this.Tables["Order Details"]));
345                                 if ((this.tableOrder_Details != null)) 
346                                 {
347                                         this.tableOrder_Details.InitVars();
348                                 }
349                                 this.tableOrders = ((OrdersDataTable)(this.Tables["Orders"]));
350                                 if ((this.tableOrders != null)) 
351                                 {
352                                         this.tableOrders.InitVars();
353                                 }
354                                 this.relationOrdersOrder_x0020_Details = this.Relations["OrdersOrder_x0020_Details"];
355                         }
356         
357                         private void InitClass() 
358                         {
359                                 this.DataSetName = "myTypedDataSet";
360                                 this.Prefix = "";
361                                 this.Namespace = "http://www.tempuri.org/myTypedDataSet.xsd";
362                                 this.Locale = new CultureInfo("en-US");
363                                 this.CaseSensitive = false;
364                                 this.EnforceConstraints = true;
365                                 this.tableOrder_Details = new Order_DetailsDataTable();
366                                 this.Tables.Add(this.tableOrder_Details);
367                                 this.tableOrders = new OrdersDataTable();
368                                 this.Tables.Add(this.tableOrders);
369                                 ForeignKeyConstraint fkc;
370                                 fkc = new ForeignKeyConstraint("OrdersOrder_x0020_Details", new DataColumn[] {
371                                                                                                                                                                                                  this.tableOrders.OrderIDColumn}, new DataColumn[] {
372                                                                                                                                                                                                                                                                                                            this.tableOrder_Details.OrderIDColumn});
373                                 this.tableOrder_Details.Constraints.Add(fkc);
374                                 fkc.AcceptRejectRule = AcceptRejectRule.None;
375                                 fkc.DeleteRule = Rule.Cascade;
376                                 fkc.UpdateRule = Rule.Cascade;
377                                 this.relationOrdersOrder_x0020_Details = new DataRelation("OrdersOrder_x0020_Details", new DataColumn[] {
378                                                                                                                                                                                                                                                         this.tableOrders.OrderIDColumn}, new DataColumn[] {
379                                                                                                                                                                                                                                                                                                                                                                   this.tableOrder_Details.OrderIDColumn}, false);
380                                 this.Relations.Add(this.relationOrdersOrder_x0020_Details);
381                         }
382         
383                         private bool ShouldSerializeOrder_Details() 
384                         {
385                                 return false;
386                         }
387         
388                         private bool ShouldSerializeOrders() 
389                         {
390                                 return false;
391                         }
392         
393                         private void SchemaChanged(object sender, CollectionChangeEventArgs e) 
394                         {
395                                 if ((e.Action == CollectionChangeAction.Remove)) 
396                                 {
397                                         this.InitVars();
398                                 }
399                         }
400         
401                         public delegate void Order_DetailsRowChangeEventHandler(object sender, Order_DetailsRowChangeEvent e);
402         
403                         public delegate void OrdersRowChangeEventHandler(object sender, OrdersRowChangeEvent e);
404         
405                                 public class Order_DetailsDataTable : DataTable, IEnumerable 
406                         {
407             
408                                 private DataColumn columnOrderID;
409             
410                                 private DataColumn columnProductID;
411             
412                                 private DataColumn columnUnitPrice;
413             
414                                 private DataColumn columnQuantity;
415             
416                                 private DataColumn columnDiscount;
417             
418                                 internal Order_DetailsDataTable() : 
419                                         base("Order Details") 
420                                 {
421                                         this.InitClass();
422                                 }
423             
424                                 internal Order_DetailsDataTable(DataTable table) : 
425                                         base(table.TableName) 
426                                 {
427                                         if ((table.CaseSensitive != table.DataSet.CaseSensitive)) 
428                                         {
429                                                 this.CaseSensitive = table.CaseSensitive;
430                                         }
431                                         if ((table.Locale.ToString() != table.DataSet.Locale.ToString())) 
432                                         {
433                                                 this.Locale = table.Locale;
434                                         }
435                                         if ((table.Namespace != table.DataSet.Namespace)) 
436                                         {
437                                                 this.Namespace = table.Namespace;
438                                         }
439                                         this.Prefix = table.Prefix;
440                                         this.MinimumCapacity = table.MinimumCapacity;
441                                         this.DisplayExpression = table.DisplayExpression;
442                                 }
443             
444                                 [Browsable(false)]
445                                 public int Count 
446                                 {
447                                         get 
448                                         {
449                                                 return this.Rows.Count;
450                                         }
451                                 }
452             
453                                 internal DataColumn OrderIDColumn 
454                                 {
455                                         get 
456                                         {
457                                                 return this.columnOrderID;
458                                         }
459                                 }
460             
461                                 internal DataColumn ProductIDColumn 
462                                 {
463                                         get 
464                                         {
465                                                 return this.columnProductID;
466                                         }
467                                 }
468             
469                                 internal DataColumn UnitPriceColumn 
470                                 {
471                                         get 
472                                         {
473                                                 return this.columnUnitPrice;
474                                         }
475                                 }
476             
477                                 internal DataColumn QuantityColumn 
478                                 {
479                                         get 
480                                         {
481                                                 return this.columnQuantity;
482                                         }
483                                 }
484             
485                                 internal DataColumn DiscountColumn 
486                                 {
487                                         get 
488                                         {
489                                                 return this.columnDiscount;
490                                         }
491                                 }
492             
493                                 public Order_DetailsRow this[int index] 
494                                 {
495                                         get 
496                                         {
497                                                 return ((Order_DetailsRow)(this.Rows[index]));
498                                         }
499                                 }
500             
501                                 public event Order_DetailsRowChangeEventHandler Order_DetailsRowChanged;
502             
503                                 public event Order_DetailsRowChangeEventHandler Order_DetailsRowChanging;
504             
505                                 public event Order_DetailsRowChangeEventHandler Order_DetailsRowDeleted;
506             
507                                 public event Order_DetailsRowChangeEventHandler Order_DetailsRowDeleting;
508             
509                                 public void AddOrder_DetailsRow(Order_DetailsRow row) 
510                                 {
511                                         this.Rows.Add(row);
512                                 }
513             
514                                 public Order_DetailsRow AddOrder_DetailsRow(OrdersRow parentOrdersRowByOrdersOrder_x0020_Details, int ProductID, Decimal UnitPrice, short Quantity, string Discount) 
515                                 {
516                                         Order_DetailsRow rowOrder_DetailsRow = ((Order_DetailsRow)(this.NewRow()));
517                                         rowOrder_DetailsRow.ItemArray = new object[] {
518                                                                                                                                          parentOrdersRowByOrdersOrder_x0020_Details[0],
519                                                                                                                                          ProductID,
520                                                                                                                                          UnitPrice,
521                                                                                                                                          Quantity,
522                                                                                                                                          Discount};
523                                         this.Rows.Add(rowOrder_DetailsRow);
524                                         return rowOrder_DetailsRow;
525                                 }
526             
527                                 public Order_DetailsRow FindByOrderIDProductID(int OrderID, int ProductID) 
528                                 {
529                                         return ((Order_DetailsRow)(this.Rows.Find(new object[] {
530                                                                                                                                                            OrderID,
531                                                                                                                                                            ProductID})));
532                                 }
533             
534                                 public IEnumerator GetEnumerator() 
535                                 {
536                                         return this.Rows.GetEnumerator();
537                                 }
538             
539                                 public override DataTable Clone() 
540                                 {
541                                         Order_DetailsDataTable cln = ((Order_DetailsDataTable)(base.Clone()));
542                                         cln.InitVars();
543                                         return cln;
544                                 }
545             
546                                 protected override DataTable CreateInstance() 
547                                 {
548                                         return new Order_DetailsDataTable();
549                                 }
550             
551                                 internal void InitVars() 
552                                 {
553                                         this.columnOrderID = this.Columns["OrderID"];
554                                         this.columnProductID = this.Columns["ProductID"];
555                                         this.columnUnitPrice = this.Columns["UnitPrice"];
556                                         this.columnQuantity = this.Columns["Quantity"];
557                                         this.columnDiscount = this.Columns["Discount"];
558                                 }
559             
560                                 private void InitClass() 
561                                 {
562                                         this.columnOrderID = new DataColumn("OrderID", typeof(int), null, MappingType.Element);
563                                         this.Columns.Add(this.columnOrderID);
564                                         this.columnProductID = new DataColumn("ProductID", typeof(int), null, MappingType.Element);
565                                         this.Columns.Add(this.columnProductID);
566                                         this.columnUnitPrice = new DataColumn("UnitPrice", typeof(Decimal), null, MappingType.Element);
567                                         this.Columns.Add(this.columnUnitPrice);
568                                         this.columnQuantity = new DataColumn("Quantity", typeof(short), null, MappingType.Element);
569                                         this.Columns.Add(this.columnQuantity);
570                                         this.columnDiscount = new DataColumn("Discount", typeof(string), null, MappingType.Element);
571                                         this.Columns.Add(this.columnDiscount);
572                                         this.Constraints.Add(new UniqueConstraint("Constraint1", new DataColumn[] {
573                                                                                                                                                                                                   this.columnOrderID,
574                                                                                                                                                                                                   this.columnProductID}, true));
575                                         this.columnOrderID.AllowDBNull = false;
576                                         this.columnProductID.AllowDBNull = false;
577                                         this.columnUnitPrice.AllowDBNull = false;
578                                         this.columnQuantity.AllowDBNull = false;
579                                         this.columnDiscount.ReadOnly = true;
580                                 }
581             
582                                 public Order_DetailsRow NewOrder_DetailsRow() 
583                                 {
584                                         return ((Order_DetailsRow)(this.NewRow()));
585                                 }
586             
587                                 protected override DataRow NewRowFromBuilder(DataRowBuilder builder) 
588                                 {
589                                         return new Order_DetailsRow(builder);
590                                 }
591             
592                                 protected override Type GetRowType() 
593                                 {
594                                         return typeof(Order_DetailsRow);
595                                 }
596             
597                                 protected override void OnRowChanged(DataRowChangeEventArgs e) 
598                                 {
599                                         base.OnRowChanged(e);
600                                         if ((this.Order_DetailsRowChanged != null)) 
601                                         {
602                                                 this.Order_DetailsRowChanged(this, new Order_DetailsRowChangeEvent(((Order_DetailsRow)(e.Row)), e.Action));
603                                         }
604                                 }
605             
606                                 protected override void OnRowChanging(DataRowChangeEventArgs e) 
607                                 {
608                                         base.OnRowChanging(e);
609                                         if ((this.Order_DetailsRowChanging != null)) 
610                                         {
611                                                 this.Order_DetailsRowChanging(this, new Order_DetailsRowChangeEvent(((Order_DetailsRow)(e.Row)), e.Action));
612                                         }
613                                 }
614             
615                                 protected override void OnRowDeleted(DataRowChangeEventArgs e) 
616                                 {
617                                         base.OnRowDeleted(e);
618                                         if ((this.Order_DetailsRowDeleted != null)) 
619                                         {
620                                                 this.Order_DetailsRowDeleted(this, new Order_DetailsRowChangeEvent(((Order_DetailsRow)(e.Row)), e.Action));
621                                         }
622                                 }
623             
624                                 protected override void OnRowDeleting(DataRowChangeEventArgs e) 
625                                 {
626                                         base.OnRowDeleting(e);
627                                         if ((this.Order_DetailsRowDeleting != null)) 
628                                         {
629                                                 this.Order_DetailsRowDeleting(this, new Order_DetailsRowChangeEvent(((Order_DetailsRow)(e.Row)), e.Action));
630                                         }
631                                 }
632             
633                                 public void RemoveOrder_DetailsRow(Order_DetailsRow row) 
634                                 {
635                                         this.Rows.Remove(row);
636                                 }
637                         }
638         
639                                 public class Order_DetailsRow : DataRow 
640                         {
641             
642                                 private Order_DetailsDataTable tableOrder_Details;
643             
644                                 internal Order_DetailsRow(DataRowBuilder rb) : 
645                                         base(rb) 
646                                 {
647                                         this.tableOrder_Details = ((Order_DetailsDataTable)(this.Table));
648                                 }
649             
650                                 public int OrderID 
651                                 {
652                                         get 
653                                         {
654                                                 return ((int)(this[this.tableOrder_Details.OrderIDColumn]));
655                                         }
656                                         set 
657                                         {
658                                                 this[this.tableOrder_Details.OrderIDColumn] = value;
659                                         }
660                                 }
661             
662                                 public int ProductID 
663                                 {
664                                         get 
665                                         {
666                                                 return ((int)(this[this.tableOrder_Details.ProductIDColumn]));
667                                         }
668                                         set 
669                                         {
670                                                 this[this.tableOrder_Details.ProductIDColumn] = value;
671                                         }
672                                 }
673             
674                                 public Decimal UnitPrice 
675                                 {
676                                         get 
677                                         {
678                                                 return ((Decimal)(this[this.tableOrder_Details.UnitPriceColumn]));
679                                         }
680                                         set 
681                                         {
682                                                 this[this.tableOrder_Details.UnitPriceColumn] = value;
683                                         }
684                                 }
685             
686                                 public short Quantity 
687                                 {
688                                         get 
689                                         {
690                                                 return ((short)(this[this.tableOrder_Details.QuantityColumn]));
691                                         }
692                                         set 
693                                         {
694                                                 this[this.tableOrder_Details.QuantityColumn] = value;
695                                         }
696                                 }
697             
698                                 public string Discount 
699                                 {
700                                         get 
701                                         {
702                                                 try 
703                                                 {
704                                                         return ((string)(this[this.tableOrder_Details.DiscountColumn]));
705                                                 }
706                                                 catch (InvalidCastException e) 
707                                                 {
708                                                         throw new StrongTypingException("Cannot get value because it is DBNull.", e);
709                                                 }
710                                         }
711                                         set 
712                                         {
713                                                 this[this.tableOrder_Details.DiscountColumn] = value;
714                                         }
715                                 }
716             
717                                 public OrdersRow OrdersRow 
718                                 {
719                                         get 
720                                         {
721                                                 return ((OrdersRow)(this.GetParentRow(this.Table.ParentRelations["OrdersOrder_x0020_Details"])));
722                                         }
723                                         set 
724                                         {
725                                                 this.SetParentRow(value, this.Table.ParentRelations["OrdersOrder_x0020_Details"]);
726                                         }
727                                 }
728             
729                                 public bool IsDiscountNull() 
730                                 {
731                                         return this.IsNull(this.tableOrder_Details.DiscountColumn);
732                                 }
733             
734                                 public void SetDiscountNull() 
735                                 {
736                                         this[this.tableOrder_Details.DiscountColumn] = Convert.DBNull;
737                                 }
738                         }
739         
740                                 public class Order_DetailsRowChangeEvent : EventArgs 
741                         {
742             
743                                 private Order_DetailsRow eventRow;
744             
745                                 private DataRowAction eventAction;
746             
747                                 public Order_DetailsRowChangeEvent(Order_DetailsRow row, DataRowAction action) 
748                                 {
749                                         this.eventRow = row;
750                                         this.eventAction = action;
751                                 }
752             
753                                 public Order_DetailsRow Row 
754                                 {
755                                         get 
756                                         {
757                                                 return this.eventRow;
758                                         }
759                                 }
760             
761                                 public DataRowAction Action 
762                                 {
763                                         get 
764                                         {
765                                                 return this.eventAction;
766                                         }
767                                 }
768                         }
769         
770                                 public class OrdersDataTable : DataTable, IEnumerable 
771                         {
772             
773                                 private DataColumn columnOrderID;
774             
775                                 private DataColumn columnCustomerID;
776             
777                                 private DataColumn columnEmployeeID;
778             
779                                 private DataColumn columnOrderDate;
780             
781                                 private DataColumn columnRequiredDate;
782             
783                                 private DataColumn columnShippedDate;
784             
785                                 private DataColumn columnShipVia;
786             
787                                 private DataColumn columnFreight;
788             
789                                 private DataColumn columnShipName;
790             
791                                 private DataColumn columnShipAddress;
792             
793                                 private DataColumn columnShipCity;
794             
795                                 private DataColumn columnShipRegion;
796             
797                                 private DataColumn columnShipPostalCode;
798             
799                                 private DataColumn columnShipCountry;
800             
801                                 internal OrdersDataTable() : 
802                                         base("Orders") 
803                                 {
804                                         this.InitClass();
805                                 }
806             
807                                 internal OrdersDataTable(DataTable table) : 
808                                         base(table.TableName) 
809                                 {
810                                         if ((table.CaseSensitive != table.DataSet.CaseSensitive)) 
811                                         {
812                                                 this.CaseSensitive = table.CaseSensitive;
813                                         }
814                                         if ((table.Locale.ToString() != table.DataSet.Locale.ToString())) 
815                                         {
816                                                 this.Locale = table.Locale;
817                                         }
818                                         if ((table.Namespace != table.DataSet.Namespace)) 
819                                         {
820                                                 this.Namespace = table.Namespace;
821                                         }
822                                         this.Prefix = table.Prefix;
823                                         this.MinimumCapacity = table.MinimumCapacity;
824                                         this.DisplayExpression = table.DisplayExpression;
825                                 }
826             
827                                 [Browsable(false)]
828                                 public int Count 
829                                 {
830                                         get 
831                                         {
832                                                 return this.Rows.Count;
833                                         }
834                                 }
835             
836                                 internal DataColumn OrderIDColumn 
837                                 {
838                                         get 
839                                         {
840                                                 return this.columnOrderID;
841                                         }
842                                 }
843             
844                                 internal DataColumn CustomerIDColumn 
845                                 {
846                                         get 
847                                         {
848                                                 return this.columnCustomerID;
849                                         }
850                                 }
851             
852                                 internal DataColumn EmployeeIDColumn 
853                                 {
854                                         get 
855                                         {
856                                                 return this.columnEmployeeID;
857                                         }
858                                 }
859             
860                                 internal DataColumn OrderDateColumn 
861                                 {
862                                         get 
863                                         {
864                                                 return this.columnOrderDate;
865                                         }
866                                 }
867             
868                                 internal DataColumn RequiredDateColumn 
869                                 {
870                                         get 
871                                         {
872                                                 return this.columnRequiredDate;
873                                         }
874                                 }
875             
876                                 internal DataColumn ShippedDateColumn 
877                                 {
878                                         get 
879                                         {
880                                                 return this.columnShippedDate;
881                                         }
882                                 }
883             
884                                 internal DataColumn ShipViaColumn 
885                                 {
886                                         get 
887                                         {
888                                                 return this.columnShipVia;
889                                         }
890                                 }
891             
892                                 internal DataColumn FreightColumn 
893                                 {
894                                         get 
895                                         {
896                                                 return this.columnFreight;
897                                         }
898                                 }
899             
900                                 internal DataColumn ShipNameColumn 
901                                 {
902                                         get 
903                                         {
904                                                 return this.columnShipName;
905                                         }
906                                 }
907             
908                                 internal DataColumn ShipAddressColumn 
909                                 {
910                                         get 
911                                         {
912                                                 return this.columnShipAddress;
913                                         }
914                                 }
915             
916                                 internal DataColumn ShipCityColumn 
917                                 {
918                                         get 
919                                         {
920                                                 return this.columnShipCity;
921                                         }
922                                 }
923             
924                                 internal DataColumn ShipRegionColumn 
925                                 {
926                                         get 
927                                         {
928                                                 return this.columnShipRegion;
929                                         }
930                                 }
931             
932                                 internal DataColumn ShipPostalCodeColumn 
933                                 {
934                                         get 
935                                         {
936                                                 return this.columnShipPostalCode;
937                                         }
938                                 }
939             
940                                 internal DataColumn ShipCountryColumn 
941                                 {
942                                         get 
943                                         {
944                                                 return this.columnShipCountry;
945                                         }
946                                 }
947             
948                                 public OrdersRow this[int index] 
949                                 {
950                                         get 
951                                         {
952                                                 return ((OrdersRow)(this.Rows[index]));
953                                         }
954                                 }
955             
956                                 public event OrdersRowChangeEventHandler OrdersRowChanged;
957             
958                                 public event OrdersRowChangeEventHandler OrdersRowChanging;
959             
960                                 public event OrdersRowChangeEventHandler OrdersRowDeleted;
961             
962                                 public event OrdersRowChangeEventHandler OrdersRowDeleting;
963             
964                                 public void AddOrdersRow(OrdersRow row) 
965                                 {
966                                         this.Rows.Add(row);
967                                 }
968             
969                                 public OrdersRow AddOrdersRow(string CustomerID, int EmployeeID, DateTime OrderDate, DateTime RequiredDate, DateTime ShippedDate, int ShipVia, Decimal Freight, string ShipName, string ShipAddress, string ShipCity, string ShipRegion, string ShipPostalCode, string ShipCountry) 
970                                 {
971                                         OrdersRow rowOrdersRow = ((OrdersRow)(this.NewRow()));
972                                         rowOrdersRow.ItemArray = new object[] {
973                                                                                                                           null,
974                                                                                                                           CustomerID,
975                                                                                                                           EmployeeID,
976                                                                                                                           OrderDate,
977                                                                                                                           RequiredDate,
978                                                                                                                           ShippedDate,
979                                                                                                                           ShipVia,
980                                                                                                                           Freight,
981                                                                                                                           ShipName,
982                                                                                                                           ShipAddress,
983                                                                                                                           ShipCity,
984                                                                                                                           ShipRegion,
985                                                                                                                           ShipPostalCode,
986                                                                                                                           ShipCountry};
987                                         this.Rows.Add(rowOrdersRow);
988                                         return rowOrdersRow;
989                                 }
990             
991                                 public OrdersRow FindByOrderID(int OrderID) 
992                                 {
993                                         return ((OrdersRow)(this.Rows.Find(new object[] {
994                                                                                                                                                 OrderID})));
995                                 }
996             
997                                 public IEnumerator GetEnumerator() 
998                                 {
999                                         return this.Rows.GetEnumerator();
1000                                 }
1001             
1002                                 public override DataTable Clone() 
1003                                 {
1004                                         OrdersDataTable cln = ((OrdersDataTable)(base.Clone()));
1005                                         cln.InitVars();
1006                                         return cln;
1007                                 }
1008             
1009                                 protected override DataTable CreateInstance() 
1010                                 {
1011                                         return new OrdersDataTable();
1012                                 }
1013             
1014                                 internal void InitVars() 
1015                                 {
1016                                         this.columnOrderID = this.Columns["OrderID"];
1017                                         this.columnCustomerID = this.Columns["CustomerID"];
1018                                         this.columnEmployeeID = this.Columns["EmployeeID"];
1019                                         this.columnOrderDate = this.Columns["OrderDate"];
1020                                         this.columnRequiredDate = this.Columns["RequiredDate"];
1021                                         this.columnShippedDate = this.Columns["ShippedDate"];
1022                                         this.columnShipVia = this.Columns["ShipVia"];
1023                                         this.columnFreight = this.Columns["Freight"];
1024                                         this.columnShipName = this.Columns["ShipName"];
1025                                         this.columnShipAddress = this.Columns["ShipAddress"];
1026                                         this.columnShipCity = this.Columns["ShipCity"];
1027                                         this.columnShipRegion = this.Columns["ShipRegion"];
1028                                         this.columnShipPostalCode = this.Columns["ShipPostalCode"];
1029                                         this.columnShipCountry = this.Columns["ShipCountry"];
1030                                 }
1031             
1032                                 private void InitClass() 
1033                                 {
1034                                         this.columnOrderID = new DataColumn("OrderID", typeof(int), null, MappingType.Element);
1035                                         this.Columns.Add(this.columnOrderID);
1036                                         this.columnCustomerID = new DataColumn("CustomerID", typeof(string), null, MappingType.Element);
1037                                         this.Columns.Add(this.columnCustomerID);
1038                                         this.columnEmployeeID = new DataColumn("EmployeeID", typeof(int), null, MappingType.Element);
1039                                         this.Columns.Add(this.columnEmployeeID);
1040                                         this.columnOrderDate = new DataColumn("OrderDate", typeof(DateTime), null, MappingType.Element);
1041                                         this.Columns.Add(this.columnOrderDate);
1042                                         this.columnRequiredDate = new DataColumn("RequiredDate", typeof(DateTime), null, MappingType.Element);
1043                                         this.Columns.Add(this.columnRequiredDate);
1044                                         this.columnShippedDate = new DataColumn("ShippedDate", typeof(DateTime), null, MappingType.Element);
1045                                         this.Columns.Add(this.columnShippedDate);
1046                                         this.columnShipVia = new DataColumn("ShipVia", typeof(int), null, MappingType.Element);
1047                                         this.Columns.Add(this.columnShipVia);
1048                                         this.columnFreight = new DataColumn("Freight", typeof(Decimal), null, MappingType.Element);
1049                                         this.Columns.Add(this.columnFreight);
1050                                         this.columnShipName = new DataColumn("ShipName", typeof(string), null, MappingType.Element);
1051                                         this.Columns.Add(this.columnShipName);
1052                                         this.columnShipAddress = new DataColumn("ShipAddress", typeof(string), null, MappingType.Element);
1053                                         this.Columns.Add(this.columnShipAddress);
1054                                         this.columnShipCity = new DataColumn("ShipCity", typeof(string), null, MappingType.Element);
1055                                         this.Columns.Add(this.columnShipCity);
1056                                         this.columnShipRegion = new DataColumn("ShipRegion", typeof(string), null, MappingType.Element);
1057                                         this.Columns.Add(this.columnShipRegion);
1058                                         this.columnShipPostalCode = new DataColumn("ShipPostalCode", typeof(string), null, MappingType.Element);
1059                                         this.Columns.Add(this.columnShipPostalCode);
1060                                         this.columnShipCountry = new DataColumn("ShipCountry", typeof(string), null, MappingType.Element);
1061                                         this.Columns.Add(this.columnShipCountry);
1062                                         this.Constraints.Add(new UniqueConstraint("Constraint1", new DataColumn[] {
1063                                                                                                                                                                                                   this.columnOrderID}, true));
1064                                         this.columnOrderID.AutoIncrement = true;
1065                                         this.columnOrderID.AllowDBNull = false;
1066                                         this.columnOrderID.ReadOnly = true;
1067                                         this.columnOrderID.Unique = true;
1068                                 }
1069             
1070                                 public OrdersRow NewOrdersRow() 
1071                                 {
1072                                         return ((OrdersRow)(this.NewRow()));
1073                                 }
1074             
1075                                 protected override DataRow NewRowFromBuilder(DataRowBuilder builder) 
1076                                 {
1077                                         return new OrdersRow(builder);
1078                                 }
1079             
1080                                 protected override Type GetRowType() 
1081                                 {
1082                                         return typeof(OrdersRow);
1083                                 }
1084             
1085                                 protected override void OnRowChanged(DataRowChangeEventArgs e) 
1086                                 {
1087                                         base.OnRowChanged(e);
1088                                         if ((this.OrdersRowChanged != null)) 
1089                                         {
1090                                                 this.OrdersRowChanged(this, new OrdersRowChangeEvent(((OrdersRow)(e.Row)), e.Action));
1091                                         }
1092                                 }
1093             
1094                                 protected override void OnRowChanging(DataRowChangeEventArgs e) 
1095                                 {
1096                                         base.OnRowChanging(e);
1097                                         if ((this.OrdersRowChanging != null)) 
1098                                         {
1099                                                 this.OrdersRowChanging(this, new OrdersRowChangeEvent(((OrdersRow)(e.Row)), e.Action));
1100                                         }
1101                                 }
1102             
1103                                 protected override void OnRowDeleted(DataRowChangeEventArgs e) 
1104                                 {
1105                                         base.OnRowDeleted(e);
1106                                         if ((this.OrdersRowDeleted != null)) 
1107                                         {
1108                                                 this.OrdersRowDeleted(this, new OrdersRowChangeEvent(((OrdersRow)(e.Row)), e.Action));
1109                                         }
1110                                 }
1111             
1112                                 protected override void OnRowDeleting(DataRowChangeEventArgs e) 
1113                                 {
1114                                         base.OnRowDeleting(e);
1115                                         if ((this.OrdersRowDeleting != null)) 
1116                                         {
1117                                                 this.OrdersRowDeleting(this, new OrdersRowChangeEvent(((OrdersRow)(e.Row)), e.Action));
1118                                         }
1119                                 }
1120             
1121                                 public void RemoveOrdersRow(OrdersRow row) 
1122                                 {
1123                                         this.Rows.Remove(row);
1124                                 }
1125                         }
1126         
1127                                 public class OrdersRow : DataRow 
1128                         {
1129             
1130                                 private OrdersDataTable tableOrders;
1131             
1132                                 internal OrdersRow(DataRowBuilder rb) : 
1133                                         base(rb) 
1134                                 {
1135                                         this.tableOrders = ((OrdersDataTable)(this.Table));
1136                                 }
1137             
1138                                 public int OrderID 
1139                                 {
1140                                         get 
1141                                         {
1142                                                 return ((int)(this[this.tableOrders.OrderIDColumn]));
1143                                         }
1144                                         set 
1145                                         {
1146                                                 this[this.tableOrders.OrderIDColumn] = value;
1147                                         }
1148                                 }
1149             
1150                                 public string CustomerID 
1151                                 {
1152                                         get 
1153                                         {
1154                                                 try 
1155                                                 {
1156                                                         return ((string)(this[this.tableOrders.CustomerIDColumn]));
1157                                                 }
1158                                                 catch (InvalidCastException e) 
1159                                                 {
1160                                                         throw new StrongTypingException("Cannot get value because it is DBNull.", e);
1161                                                 }
1162                                         }
1163                                         set 
1164                                         {
1165                                                 this[this.tableOrders.CustomerIDColumn] = value;
1166                                         }
1167                                 }
1168             
1169                                 public int EmployeeID 
1170                                 {
1171                                         get 
1172                                         {
1173                                                 try 
1174                                                 {
1175                                                         return ((int)(this[this.tableOrders.EmployeeIDColumn]));
1176                                                 }
1177                                                 catch (InvalidCastException e) 
1178                                                 {
1179                                                         throw new StrongTypingException("Cannot get value because it is DBNull.", e);
1180                                                 }
1181                                         }
1182                                         set 
1183                                         {
1184                                                 this[this.tableOrders.EmployeeIDColumn] = value;
1185                                         }
1186                                 }
1187             
1188                                 public DateTime OrderDate 
1189                                 {
1190                                         get 
1191                                         {
1192                                                 try 
1193                                                 {
1194                                                         return ((DateTime)(this[this.tableOrders.OrderDateColumn]));
1195                                                 }
1196                                                 catch (InvalidCastException e) 
1197                                                 {
1198                                                         throw new StrongTypingException("Cannot get value because it is DBNull.", e);
1199                                                 }
1200                                         }
1201                                         set 
1202                                         {
1203                                                 this[this.tableOrders.OrderDateColumn] = value;
1204                                         }
1205                                 }
1206             
1207                                 public DateTime RequiredDate 
1208                                 {
1209                                         get 
1210                                         {
1211                                                 try 
1212                                                 {
1213                                                         return ((DateTime)(this[this.tableOrders.RequiredDateColumn]));
1214                                                 }
1215                                                 catch (InvalidCastException e) 
1216                                                 {
1217                                                         throw new StrongTypingException("Cannot get value because it is DBNull.", e);
1218                                                 }
1219                                         }
1220                                         set 
1221                                         {
1222                                                 this[this.tableOrders.RequiredDateColumn] = value;
1223                                         }
1224                                 }
1225             
1226                                 public DateTime ShippedDate 
1227                                 {
1228                                         get 
1229                                         {
1230                                                 try 
1231                                                 {
1232                                                         return ((DateTime)(this[this.tableOrders.ShippedDateColumn]));
1233                                                 }
1234                                                 catch (InvalidCastException e) 
1235                                                 {
1236                                                         throw new StrongTypingException("Cannot get value because it is DBNull.", e);
1237                                                 }
1238                                         }
1239                                         set 
1240                                         {
1241                                                 this[this.tableOrders.ShippedDateColumn] = value;
1242                                         }
1243                                 }
1244             
1245                                 public int ShipVia 
1246                                 {
1247                                         get 
1248                                         {
1249                                                 try 
1250                                                 {
1251                                                         return ((int)(this[this.tableOrders.ShipViaColumn]));
1252                                                 }
1253                                                 catch (InvalidCastException e) 
1254                                                 {
1255                                                         throw new StrongTypingException("Cannot get value because it is DBNull.", e);
1256                                                 }
1257                                         }
1258                                         set 
1259                                         {
1260                                                 this[this.tableOrders.ShipViaColumn] = value;
1261                                         }
1262                                 }
1263             
1264                                 public Decimal Freight 
1265                                 {
1266                                         get 
1267                                         {
1268                                                 try 
1269                                                 {
1270                                                         return ((Decimal)(this[this.tableOrders.FreightColumn]));
1271                                                 }
1272                                                 catch (InvalidCastException e) 
1273                                                 {
1274                                                         throw new StrongTypingException("Cannot get value because it is DBNull.", e);
1275                                                 }
1276                                         }
1277                                         set 
1278                                         {
1279                                                 this[this.tableOrders.FreightColumn] = value;
1280                                         }
1281                                 }
1282             
1283                                 public string ShipName 
1284                                 {
1285                                         get 
1286                                         {
1287                                                 try 
1288                                                 {
1289                                                         return ((string)(this[this.tableOrders.ShipNameColumn]));
1290                                                 }
1291                                                 catch (InvalidCastException e) 
1292                                                 {
1293                                                         throw new StrongTypingException("Cannot get value because it is DBNull.", e);
1294                                                 }
1295                                         }
1296                                         set 
1297                                         {
1298                                                 this[this.tableOrders.ShipNameColumn] = value;
1299                                         }
1300                                 }
1301             
1302                                 public string ShipAddress 
1303                                 {
1304                                         get 
1305                                         {
1306                                                 try 
1307                                                 {
1308                                                         return ((string)(this[this.tableOrders.ShipAddressColumn]));
1309                                                 }
1310                                                 catch (InvalidCastException e) 
1311                                                 {
1312                                                         throw new StrongTypingException("Cannot get value because it is DBNull.", e);
1313                                                 }
1314                                         }
1315                                         set 
1316                                         {
1317                                                 this[this.tableOrders.ShipAddressColumn] = value;
1318                                         }
1319                                 }
1320             
1321                                 public string ShipCity 
1322                                 {
1323                                         get 
1324                                         {
1325                                                 try 
1326                                                 {
1327                                                         return ((string)(this[this.tableOrders.ShipCityColumn]));
1328                                                 }
1329                                                 catch (InvalidCastException e) 
1330                                                 {
1331                                                         throw new StrongTypingException("Cannot get value because it is DBNull.", e);
1332                                                 }
1333                                         }
1334                                         set 
1335                                         {
1336                                                 this[this.tableOrders.ShipCityColumn] = value;
1337                                         }
1338                                 }
1339             
1340                                 public string ShipRegion 
1341                                 {
1342                                         get 
1343                                         {
1344                                                 try 
1345                                                 {
1346                                                         return ((string)(this[this.tableOrders.ShipRegionColumn]));
1347                                                 }
1348                                                 catch (InvalidCastException e) 
1349                                                 {
1350                                                         throw new StrongTypingException("Cannot get value because it is DBNull.", e);
1351                                                 }
1352                                         }
1353                                         set 
1354                                         {
1355                                                 this[this.tableOrders.ShipRegionColumn] = value;
1356                                         }
1357                                 }
1358             
1359                                 public string ShipPostalCode 
1360                                 {
1361                                         get 
1362                                         {
1363                                                 try 
1364                                                 {
1365                                                         return ((string)(this[this.tableOrders.ShipPostalCodeColumn]));
1366                                                 }
1367                                                 catch (InvalidCastException e) 
1368                                                 {
1369                                                         throw new StrongTypingException("Cannot get value because it is DBNull.", e);
1370                                                 }
1371                                         }
1372                                         set 
1373                                         {
1374                                                 this[this.tableOrders.ShipPostalCodeColumn] = value;
1375                                         }
1376                                 }
1377             
1378                                 public string ShipCountry 
1379                                 {
1380                                         get 
1381                                         {
1382                                                 try 
1383                                                 {
1384                                                         return ((string)(this[this.tableOrders.ShipCountryColumn]));
1385                                                 }
1386                                                 catch (InvalidCastException e) 
1387                                                 {
1388                                                         throw new StrongTypingException("Cannot get value because it is DBNull.", e);
1389                                                 }
1390                                         }
1391                                         set 
1392                                         {
1393                                                 this[this.tableOrders.ShipCountryColumn] = value;
1394                                         }
1395                                 }
1396             
1397                                 public bool IsCustomerIDNull() 
1398                                 {
1399                                         return this.IsNull(this.tableOrders.CustomerIDColumn);
1400                                 }
1401             
1402                                 public void SetCustomerIDNull() 
1403                                 {
1404                                         this[this.tableOrders.CustomerIDColumn] = Convert.DBNull;
1405                                 }
1406             
1407                                 public bool IsEmployeeIDNull() 
1408                                 {
1409                                         return this.IsNull(this.tableOrders.EmployeeIDColumn);
1410                                 }
1411             
1412                                 public void SetEmployeeIDNull() 
1413                                 {
1414                                         this[this.tableOrders.EmployeeIDColumn] = Convert.DBNull;
1415                                 }
1416             
1417                                 public bool IsOrderDateNull() 
1418                                 {
1419                                         return this.IsNull(this.tableOrders.OrderDateColumn);
1420                                 }
1421             
1422                                 public void SetOrderDateNull() 
1423                                 {
1424                                         this[this.tableOrders.OrderDateColumn] = Convert.DBNull;
1425                                 }
1426             
1427                                 public bool IsRequiredDateNull() 
1428                                 {
1429                                         return this.IsNull(this.tableOrders.RequiredDateColumn);
1430                                 }
1431             
1432                                 public void SetRequiredDateNull() 
1433                                 {
1434                                         this[this.tableOrders.RequiredDateColumn] = Convert.DBNull;
1435                                 }
1436             
1437                                 public bool IsShippedDateNull() 
1438                                 {
1439                                         return this.IsNull(this.tableOrders.ShippedDateColumn);
1440                                 }
1441             
1442                                 public void SetShippedDateNull() 
1443                                 {
1444                                         this[this.tableOrders.ShippedDateColumn] = Convert.DBNull;
1445                                 }
1446             
1447                                 public bool IsShipViaNull() 
1448                                 {
1449                                         return this.IsNull(this.tableOrders.ShipViaColumn);
1450                                 }
1451             
1452                                 public void SetShipViaNull() 
1453                                 {
1454                                         this[this.tableOrders.ShipViaColumn] = Convert.DBNull;
1455                                 }
1456             
1457                                 public bool IsFreightNull() 
1458                                 {
1459                                         return this.IsNull(this.tableOrders.FreightColumn);
1460                                 }
1461             
1462                                 public void SetFreightNull() 
1463                                 {
1464                                         this[this.tableOrders.FreightColumn] = Convert.DBNull;
1465                                 }
1466             
1467                                 public bool IsShipNameNull() 
1468                                 {
1469                                         return this.IsNull(this.tableOrders.ShipNameColumn);
1470                                 }
1471             
1472                                 public void SetShipNameNull() 
1473                                 {
1474                                         this[this.tableOrders.ShipNameColumn] = Convert.DBNull;
1475                                 }
1476             
1477                                 public bool IsShipAddressNull() 
1478                                 {
1479                                         return this.IsNull(this.tableOrders.ShipAddressColumn);
1480                                 }
1481             
1482                                 public void SetShipAddressNull() 
1483                                 {
1484                                         this[this.tableOrders.ShipAddressColumn] = Convert.DBNull;
1485                                 }
1486             
1487                                 public bool IsShipCityNull() 
1488                                 {
1489                                         return this.IsNull(this.tableOrders.ShipCityColumn);
1490                                 }
1491             
1492                                 public void SetShipCityNull() 
1493                                 {
1494                                         this[this.tableOrders.ShipCityColumn] = Convert.DBNull;
1495                                 }
1496             
1497                                 public bool IsShipRegionNull() 
1498                                 {
1499                                         return this.IsNull(this.tableOrders.ShipRegionColumn);
1500                                 }
1501             
1502                                 public void SetShipRegionNull() 
1503                                 {
1504                                         this[this.tableOrders.ShipRegionColumn] = Convert.DBNull;
1505                                 }
1506             
1507                                 public bool IsShipPostalCodeNull() 
1508                                 {
1509                                         return this.IsNull(this.tableOrders.ShipPostalCodeColumn);
1510                                 }
1511             
1512                                 public void SetShipPostalCodeNull() 
1513                                 {
1514                                         this[this.tableOrders.ShipPostalCodeColumn] = Convert.DBNull;
1515                                 }
1516             
1517                                 public bool IsShipCountryNull() 
1518                                 {
1519                                         return this.IsNull(this.tableOrders.ShipCountryColumn);
1520                                 }
1521             
1522                                 public void SetShipCountryNull() 
1523                                 {
1524                                         this[this.tableOrders.ShipCountryColumn] = Convert.DBNull;
1525                                 }
1526             
1527                                 public Order_DetailsRow[] GetOrder_DetailsRows() 
1528                                 {
1529                                         return ((Order_DetailsRow[])(this.GetChildRows(this.Table.ChildRelations["OrdersOrder_x0020_Details"])));
1530                                 }
1531                         }
1532         
1533                                 public class OrdersRowChangeEvent : EventArgs 
1534                         {
1535             
1536                                 private OrdersRow eventRow;
1537             
1538                                 private DataRowAction eventAction;
1539             
1540                                 public OrdersRowChangeEvent(OrdersRow row, DataRowAction action) 
1541                                 {
1542                                         this.eventRow = row;
1543                                         this.eventAction = action;
1544                                 }
1545             
1546                                 public OrdersRow Row 
1547                                 {
1548                                         get 
1549                                         {
1550                                                 return this.eventRow;
1551                                         }
1552                                 }
1553             
1554                                 public DataRowAction Action 
1555                                 {
1556                                         get 
1557                                         {
1558                                                 return this.eventAction;
1559                                         }
1560                                 }
1561                         }
1562                 }
1563         }
1564 }