// ------------------------------------------------------------------------------
//  <autogenerated>
//      This code was generated by a tool.
//      Mono Runtime Version: 1.1.4322.2032
// 
//      Changes to this file may cause incorrect behavior and will be lost if 
//      the code is regenerated.
//  </autogenerated>
// ------------------------------------------------------------------------------

// 
//This source code was auto-generated by MonoXSD
//
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Runtime.Serialization;
using System.Xml;


public class MonkeyDataSet : System.Data.DataSet, System.Xml.Serialization.IXmlSerializable {
    
    public delegate void MonkeyTableRowChangedEventHandler(object o, MonkeyTableRowChangedEventArgs e);
    
    private MonkeyTableDataTable __tableMonkeyTable;
    
    public MonkeyDataSet() {
        this.InitializeClass();
        System.ComponentModel.CollectionChangeEventHandler handler = new System.ComponentModel.CollectionChangeEventHandler(new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged));
        this.Tables.CollectionChanged += handler;
        this.Relations.CollectionChanged += handler;
    }
    
    protected MonkeyDataSet(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext ctx) {
        // TODO: implement
        throw new System.NotImplementedException();
    }
    
    public virtual MonkeyTableDataTable MonkeyTable {
        get {
            return this.__tableMonkeyTable;
        }
    }
    
    public override System.Data.DataSet Clone() {
        MonkeyDataSet set = ((MonkeyDataSet)(base.Clone()));
        set.InitializeFields();
        return set;
    }
    
    protected override System.Xml.Schema.XmlSchema GetSchemaSerializable() {
        System.IO.StringWriter sw = new System.IO.StringWriter();
        this.WriteXmlSchema(sw);
        return System.Xml.Schema.XmlSchema.Read(new System.Xml.XmlTextReader(new System.IO.StringReader(sw.ToString())), null);
    }
    
    System.Xml.Schema.XmlSchema System.Xml.Serialization.IXmlSerializable.GetSchema() {
        return this.GetSchemaSerializable();
    }
    
    internal void InitializeClass() {
        this.DataSetName = "MonkeyDataSet";
        this.Prefix = "";
        this.Namespace = "";
        this.Locale = new System.Globalization.CultureInfo("ja-JP");
        this.CaseSensitive = false;
        this.EnforceConstraints = true;
        this.__tableMonkeyTable = new MonkeyTableDataTable();
        this.Tables.Add(this.__tableMonkeyTable);
    }
    
    internal void InitializeFields() {
        this.__tableMonkeyTable.InitializeFields();
    }
    
    private void SchemaChanged(object sender, System.ComponentModel.CollectionChangeEventArgs e) {
        if ((e.Action == System.ComponentModel.CollectionChangeAction.Remove)) {
            this.InitializeFields();
        }
    }
    
    public class MonkeyTableDataTable : System.Data.DataTable, System.Collections.IEnumerable {
        
        private System.Data.DataColumn __columnID;
        
        private System.Data.DataColumn __columnName;
        
        private System.Data.DataColumn __columnAge;
        
        private System.Data.DataColumn __columnExists;
        
        internal MonkeyTableDataTable() : 
                base("MonkeyTable") {
            this.InitializeClass();
            this.InitializeFields();
        }
        
        internal MonkeyTableDataTable(System.Data.DataTable tableMonkeyTable) : 
                base(tableMonkeyTable.TableName) {
            // TODO: implement
            throw new System.NotImplementedException();
        }
        
        public virtual int Count {
            get {
                return this.Rows.Count;
            }
        }
        
        public virtual MonkeyTableRow this[int i] {
            get {
                return ((MonkeyTableRow)(this.Rows[i]));
            }
        }
        
        internal System.Data.DataColumn IDColumn {
            get {
                return this.__columnID;
            }
        }
        
        internal System.Data.DataColumn NameColumn {
            get {
                return this.__columnName;
            }
        }
        
        internal System.Data.DataColumn AgeColumn {
            get {
                return this.__columnAge;
            }
        }
        
        internal System.Data.DataColumn ExistsColumn {
            get {
                return this.__columnExists;
            }
        }
        
        public event MonkeyTableRowChangedEventHandler MonkeyTableRowChanging;
        
        public event MonkeyTableRowChangedEventHandler MonkeyTableRowChanged;
        
        public event MonkeyTableRowChangedEventHandler MonkeyTableRowDeleting;
        
        public event MonkeyTableRowChangedEventHandler MonkeyTableRowDeleted;
        
        private void InitializeClass() {
            this.Columns.Add(new System.Data.DataColumn("ID", typeof(System.Guid)));
            this.Columns.Add(new System.Data.DataColumn("Name", typeof(string)));
            this.Columns.Add(new System.Data.DataColumn("Age", typeof(int)));
            this.Columns.Add(new System.Data.DataColumn("Exists", typeof(bool)));
        }
        
        internal void InitializeFields() {
            this.__columnID = this.Columns["ID"];
            this.__columnName = this.Columns["Name"];
            this.__columnAge = this.Columns["Age"];
            this.__columnExists = this.Columns["Exists"];
        }
        
        public virtual System.Collections.IEnumerator GetEnumerator() {
            return this.Rows.GetEnumerator();
        }
        
        public override System.Data.DataTable Clone() {
            MonkeyTableDataTable t = ((MonkeyTableDataTable)(base.Clone()));
            t.InitializeFields();
            return t;
        }
        
        protected override System.Data.DataTable CreateInstance() {
            return new MonkeyTableDataTable();
        }
        
        public virtual void AddMonkeyTableRow(MonkeyTableRow row) {
            this.Rows.Add(row);
        }
        
        public virtual MonkeyTableRow AddMonkeyTableRow(System.Guid ID, string Name, int Age, bool Exists) {
            MonkeyTableRow row = this.NewMonkeyTableRow();
            row["ID"] = ID;
            row["Name"] = Name;
            row["Age"] = Age;
            row["Exists"] = Exists;
            this.Rows.Add(row);
            return row;
        }
        
        public virtual MonkeyTableRow NewMonkeyTableRow() {
            return ((MonkeyTableRow)(this.NewRow()));
        }
        
        protected override System.Data.DataRow NewRowFromBuilder(System.Data.DataRowBuilder builder) {
            return new MonkeyTableRow(builder);
        }
        
        public virtual void RemoveMonkeyTableRow(MonkeyTableRow row) {
            this.Rows.Remove(row);
        }
        
        protected override System.Type GetRowType() {
            return typeof(MonkeyTableRow);
        }
        
        protected override void OnRowChanging(System.Data.DataRowChangeEventArgs e) {
            base.OnRowChanging(e);
            if ((this.MonkeyTableRowChanging != null)) {
                this.MonkeyTableRowChanging(this, new MonkeyTableRowChangedEventArgs(((MonkeyTableRow)(e.Row)), e.Action));
            }
        }
        
        protected override void OnRowChanged(System.Data.DataRowChangeEventArgs e) {
            base.OnRowChanged(e);
            if ((this.MonkeyTableRowChanged != null)) {
                this.MonkeyTableRowChanged(this, new MonkeyTableRowChangedEventArgs(((MonkeyTableRow)(e.Row)), e.Action));
            }
        }
        
        protected override void OnRowDeleting(System.Data.DataRowChangeEventArgs e) {
            base.OnRowDeleting(e);
            if ((this.MonkeyTableRowDeleting != null)) {
                this.MonkeyTableRowDeleting(this, new MonkeyTableRowChangedEventArgs(((MonkeyTableRow)(e.Row)), e.Action));
            }
        }
        
        protected override void OnRowDeleted(System.Data.DataRowChangeEventArgs e) {
            base.OnRowDeleted(e);
            if ((this.MonkeyTableRowDeleted != null)) {
                this.MonkeyTableRowDeleted(this, new MonkeyTableRowChangedEventArgs(((MonkeyTableRow)(e.Row)), e.Action));
            }
        }
    }
    
    public class MonkeyTableRow : System.Data.DataRow {
        
        private MonkeyTableDataTable tableMonkeyTable;
        
        internal MonkeyTableRow(System.Data.DataRowBuilder builder) : 
                base(builder) {
            this.tableMonkeyTable = ((MonkeyTableDataTable)(this.Table));
        }
        
        public virtual System.Guid ID {
            get {
                object ret = this[this.tableMonkeyTable.IDColumn];
                if ((ret == System.DBNull.Value)) {
                    throw new System.Data.StrongTypingException("Cannot get strong typed value since it is DB null.", null);
                }
                else {
                    return ((System.Guid)(ret));
                }
            }
            set {
                this[this.tableMonkeyTable.IDColumn] = value;
            }
        }
        
        public virtual string Name {
            get {
                object ret = this[this.tableMonkeyTable.NameColumn];
                if ((ret == System.DBNull.Value)) {
                    throw new System.Data.StrongTypingException("Cannot get strong typed value since it is DB null.", null);
                }
                else {
                    return ((string)(ret));
                }
            }
            set {
                this[this.tableMonkeyTable.NameColumn] = value;
            }
        }
        
        public virtual int Age {
            get {
                object ret = this[this.tableMonkeyTable.AgeColumn];
                if ((ret == System.DBNull.Value)) {
                    throw new System.Data.StrongTypingException("Cannot get strong typed value since it is DB null.", null);
                }
                else {
                    return ((int)(ret));
                }
            }
            set {
                this[this.tableMonkeyTable.AgeColumn] = value;
            }
        }
        
        public virtual bool Exists {
            get {
                object ret = this[this.tableMonkeyTable.ExistsColumn];
                if ((ret == System.DBNull.Value)) {
                    throw new System.Data.StrongTypingException("Cannot get strong typed value since it is DB null.", null);
                }
                else {
                    return ((bool)(ret));
                }
            }
            set {
                this[this.tableMonkeyTable.ExistsColumn] = value;
            }
        }
        
        public virtual bool IsIDNull() {
            return this.IsNull(this.tableMonkeyTable.IDColumn);
        }
        
        public virtual void SetIDNull() {
            this[this.tableMonkeyTable.IDColumn] = System.DBNull.Value;
        }
        
        public virtual bool IsNameNull() {
            return this.IsNull(this.tableMonkeyTable.NameColumn);
        }
        
        public virtual void SetNameNull() {
            this[this.tableMonkeyTable.NameColumn] = System.DBNull.Value;
        }
        
        public virtual bool IsAgeNull() {
            return this.IsNull(this.tableMonkeyTable.AgeColumn);
        }
        
        public virtual void SetAgeNull() {
            this[this.tableMonkeyTable.AgeColumn] = System.DBNull.Value;
        }
        
        public virtual bool IsExistsNull() {
            return this.IsNull(this.tableMonkeyTable.ExistsColumn);
        }
        
        public virtual void SetExistsNull() {
            this[this.tableMonkeyTable.ExistsColumn] = System.DBNull.Value;
        }
    }
    
    public class MonkeyTableRowChangedEventArgs : System.EventArgs {
        
        private MonkeyTableRow eventRow;
        
        private System.Data.DataRowAction eventAction;
        
        public MonkeyTableRowChangedEventArgs(MonkeyTableRow r, System.Data.DataRowAction a) {
            this.eventRow = r;
            this.eventAction = a;
        }
        
        public MonkeyTableRow Row {
            get {
                return this.eventRow;
            }
        }
        
        public System.Data.DataRowAction Action {
            get {
                return this.eventAction;
            }
        }
    }
}
