Click here to Skip to main content
Click here to Skip to main content
Articles » Languages » XML » General » Downloads
 
Add your own
alternative version

Binding any object data members at design time

, 8 Nov 2004
Enables binding of any public data member of any object into a control at design time.
agconfig.zip
AgConfig
AgConfig.csproj.user
bin
Debug
AgConfig.dll
configtest.zip
ConfigTest
App.ico
AppData
AppData.csproj.user
bin
Debug
AppData.dll
AppData.xsx
bin
Debug
AgConfig.dll
AppData.dll
ConfigTest.exe
ConfigTest.csproj.user
//------------------------------------------------------------------------------
// <autogenerated>
//     This code was generated by a tool.
//     Runtime Version: 1.1.4322.2032
//
//     Changes to this file may cause incorrect behavior and will be lost if 
//     the code is regenerated.
// </autogenerated>
//------------------------------------------------------------------------------

namespace ConfigTest {
    using System;
    using System.Data;
    using System.Xml;
    using System.Runtime.Serialization;
    
    
    [Serializable()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Diagnostics.DebuggerStepThrough()]
    [System.ComponentModel.ToolboxItem(true)]
    public class AppDataDataSet : DataSet {
        
        private AppDataDataTable tableAppData;
        
        private Section1DataTable tableSection1;
        
        private ItemsDataTable tableItems;
        
        private _ItemDataTable table_Item;
        
        private DataRelation relationItems_Item;
        
        private DataRelation relationAppData_Section1;
        
        private DataRelation relationAppData_Items;
        
        public AppDataDataSet() {
            this.InitClass();
            System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
            this.Tables.CollectionChanged += schemaChangedHandler;
            this.Relations.CollectionChanged += schemaChangedHandler;
        }
        
        protected AppDataDataSet(SerializationInfo info, StreamingContext context) {
            string strSchema = ((string)(info.GetValue("XmlSchema", typeof(string))));
            if ((strSchema != null)) {
                DataSet ds = new DataSet();
                ds.ReadXmlSchema(new XmlTextReader(new System.IO.StringReader(strSchema)));
                if ((ds.Tables["AppData"] != null)) {
                    this.Tables.Add(new AppDataDataTable(ds.Tables["AppData"]));
                }
                if ((ds.Tables["Section1"] != null)) {
                    this.Tables.Add(new Section1DataTable(ds.Tables["Section1"]));
                }
                if ((ds.Tables["Items"] != null)) {
                    this.Tables.Add(new ItemsDataTable(ds.Tables["Items"]));
                }
                if ((ds.Tables["Item"] != null)) {
                    this.Tables.Add(new _ItemDataTable(ds.Tables["Item"]));
                }
                this.DataSetName = ds.DataSetName;
                this.Prefix = ds.Prefix;
                this.Namespace = ds.Namespace;
                this.Locale = ds.Locale;
                this.CaseSensitive = ds.CaseSensitive;
                this.EnforceConstraints = ds.EnforceConstraints;
                this.Merge(ds, false, System.Data.MissingSchemaAction.Add);
                this.InitVars();
            }
            else {
                this.InitClass();
            }
            this.GetSerializationData(info, context);
            System.ComponentModel.CollectionChangeEventHandler schemaChangedHandler = new System.ComponentModel.CollectionChangeEventHandler(this.SchemaChanged);
            this.Tables.CollectionChanged += schemaChangedHandler;
            this.Relations.CollectionChanged += schemaChangedHandler;
        }
        
        [System.ComponentModel.Browsable(false)]
        [System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Content)]
        public AppDataDataTable AppData {
            get {
                return this.tableAppData;
            }
        }
        
        [System.ComponentModel.Browsable(false)]
        [System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Content)]
        public Section1DataTable Section1 {
            get {
                return this.tableSection1;
            }
        }
        
        [System.ComponentModel.Browsable(false)]
        [System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Content)]
        public ItemsDataTable Items {
            get {
                return this.tableItems;
            }
        }
        
        [System.ComponentModel.Browsable(false)]
        [System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Content)]
        public _ItemDataTable _Item {
            get {
                return this.table_Item;
            }
        }
        
        public override DataSet Clone() {
            AppDataDataSet cln = ((AppDataDataSet)(base.Clone()));
            cln.InitVars();
            return cln;
        }
        
        protected override bool ShouldSerializeTables() {
            return false;
        }
        
        protected override bool ShouldSerializeRelations() {
            return false;
        }
        
        protected override void ReadXmlSerializable(XmlReader reader) {
            this.Reset();
            DataSet ds = new DataSet();
            ds.ReadXml(reader);
            if ((ds.Tables["AppData"] != null)) {
                this.Tables.Add(new AppDataDataTable(ds.Tables["AppData"]));
            }
            if ((ds.Tables["Section1"] != null)) {
                this.Tables.Add(new Section1DataTable(ds.Tables["Section1"]));
            }
            if ((ds.Tables["Items"] != null)) {
                this.Tables.Add(new ItemsDataTable(ds.Tables["Items"]));
            }
            if ((ds.Tables["Item"] != null)) {
                this.Tables.Add(new _ItemDataTable(ds.Tables["Item"]));
            }
            this.DataSetName = ds.DataSetName;
            this.Prefix = ds.Prefix;
            this.Namespace = ds.Namespace;
            this.Locale = ds.Locale;
            this.CaseSensitive = ds.CaseSensitive;
            this.EnforceConstraints = ds.EnforceConstraints;
            this.Merge(ds, false, System.Data.MissingSchemaAction.Add);
            this.InitVars();
        }
        
        protected override System.Xml.Schema.XmlSchema GetSchemaSerializable() {
            System.IO.MemoryStream stream = new System.IO.MemoryStream();
            this.WriteXmlSchema(new XmlTextWriter(stream, null));
            stream.Position = 0;
            return System.Xml.Schema.XmlSchema.Read(new XmlTextReader(stream), null);
        }
        
        internal void InitVars() {
            this.tableAppData = ((AppDataDataTable)(this.Tables["AppData"]));
            if ((this.tableAppData != null)) {
                this.tableAppData.InitVars();
            }
            this.tableSection1 = ((Section1DataTable)(this.Tables["Section1"]));
            if ((this.tableSection1 != null)) {
                this.tableSection1.InitVars();
            }
            this.tableItems = ((ItemsDataTable)(this.Tables["Items"]));
            if ((this.tableItems != null)) {
                this.tableItems.InitVars();
            }
            this.table_Item = ((_ItemDataTable)(this.Tables["Item"]));
            if ((this.table_Item != null)) {
                this.table_Item.InitVars();
            }
            this.relationItems_Item = this.Relations["Items_Item"];
            this.relationAppData_Section1 = this.Relations["AppData_Section1"];
            this.relationAppData_Items = this.Relations["AppData_Items"];
        }
        
        private void InitClass() {
            this.DataSetName = "AppDataDataSet";
            this.Prefix = "";
            this.Namespace = "ConfigTest.AppData";
            this.Locale = new System.Globalization.CultureInfo("sk-SK");
            this.CaseSensitive = false;
            this.EnforceConstraints = true;
            this.tableAppData = new AppDataDataTable();
            this.Tables.Add(this.tableAppData);
            this.tableSection1 = new Section1DataTable();
            this.Tables.Add(this.tableSection1);
            this.tableItems = new ItemsDataTable();
            this.Tables.Add(this.tableItems);
            this.table_Item = new _ItemDataTable();
            this.Tables.Add(this.table_Item);
            ForeignKeyConstraint fkc;
            fkc = new ForeignKeyConstraint("AppData_Section1", new DataColumn[] {
                        this.tableAppData.AppData_IdColumn}, new DataColumn[] {
                        this.tableSection1.AppData_IdColumn});
            this.tableSection1.Constraints.Add(fkc);
            fkc.AcceptRejectRule = System.Data.AcceptRejectRule.None;
            fkc.DeleteRule = System.Data.Rule.Cascade;
            fkc.UpdateRule = System.Data.Rule.Cascade;
            fkc = new ForeignKeyConstraint("AppData_Items", new DataColumn[] {
                        this.tableAppData.AppData_IdColumn}, new DataColumn[] {
                        this.tableItems.AppData_IdColumn});
            this.tableItems.Constraints.Add(fkc);
            fkc.AcceptRejectRule = System.Data.AcceptRejectRule.None;
            fkc.DeleteRule = System.Data.Rule.Cascade;
            fkc.UpdateRule = System.Data.Rule.Cascade;
            fkc = new ForeignKeyConstraint("Items_Item", new DataColumn[] {
                        this.tableItems.Items_IdColumn}, new DataColumn[] {
                        this.table_Item.Items_IdColumn});
            this.table_Item.Constraints.Add(fkc);
            fkc.AcceptRejectRule = System.Data.AcceptRejectRule.None;
            fkc.DeleteRule = System.Data.Rule.Cascade;
            fkc.UpdateRule = System.Data.Rule.Cascade;
            this.relationItems_Item = new DataRelation("Items_Item", new DataColumn[] {
                        this.tableItems.Items_IdColumn}, new DataColumn[] {
                        this.table_Item.Items_IdColumn}, false);
            this.relationItems_Item.Nested = true;
            this.Relations.Add(this.relationItems_Item);
            this.relationAppData_Section1 = new DataRelation("AppData_Section1", new DataColumn[] {
                        this.tableAppData.AppData_IdColumn}, new DataColumn[] {
                        this.tableSection1.AppData_IdColumn}, false);
            this.relationAppData_Section1.Nested = true;
            this.Relations.Add(this.relationAppData_Section1);
            this.relationAppData_Items = new DataRelation("AppData_Items", new DataColumn[] {
                        this.tableAppData.AppData_IdColumn}, new DataColumn[] {
                        this.tableItems.AppData_IdColumn}, false);
            this.relationAppData_Items.Nested = true;
            this.Relations.Add(this.relationAppData_Items);
        }
        
        private bool ShouldSerializeAppData() {
            return false;
        }
        
        private bool ShouldSerializeSection1() {
            return false;
        }
        
        private bool ShouldSerializeItems() {
            return false;
        }
        
        private bool ShouldSerialize_Item() {
            return false;
        }
        
        private void SchemaChanged(object sender, System.ComponentModel.CollectionChangeEventArgs e) {
            if ((e.Action == System.ComponentModel.CollectionChangeAction.Remove)) {
                this.InitVars();
            }
        }
        
        public delegate void AppDataRowChangeEventHandler(object sender, AppDataRowChangeEvent e);
        
        public delegate void Section1RowChangeEventHandler(object sender, Section1RowChangeEvent e);
        
        public delegate void ItemsRowChangeEventHandler(object sender, ItemsRowChangeEvent e);
        
        public delegate void _ItemRowChangeEventHandler(object sender, _ItemRowChangeEvent e);
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class AppDataDataTable : DataTable, System.Collections.IEnumerable {
            
            private DataColumn columnText;
            
            private DataColumn columnNumber;
            
            private DataColumn columnAppData_Id;
            
            internal AppDataDataTable() : 
                    base("AppData") {
                this.InitClass();
            }
            
            internal AppDataDataTable(DataTable table) : 
                    base(table.TableName) {
                if ((table.CaseSensitive != table.DataSet.CaseSensitive)) {
                    this.CaseSensitive = table.CaseSensitive;
                }
                if ((table.Locale.ToString() != table.DataSet.Locale.ToString())) {
                    this.Locale = table.Locale;
                }
                if ((table.Namespace != table.DataSet.Namespace)) {
                    this.Namespace = table.Namespace;
                }
                this.Prefix = table.Prefix;
                this.MinimumCapacity = table.MinimumCapacity;
                this.DisplayExpression = table.DisplayExpression;
            }
            
            [System.ComponentModel.Browsable(false)]
            public int Count {
                get {
                    return this.Rows.Count;
                }
            }
            
            internal DataColumn TextColumn {
                get {
                    return this.columnText;
                }
            }
            
            internal DataColumn NumberColumn {
                get {
                    return this.columnNumber;
                }
            }
            
            internal DataColumn AppData_IdColumn {
                get {
                    return this.columnAppData_Id;
                }
            }
            
            public AppDataRow this[int index] {
                get {
                    return ((AppDataRow)(this.Rows[index]));
                }
            }
            
            public event AppDataRowChangeEventHandler AppDataRowChanged;
            
            public event AppDataRowChangeEventHandler AppDataRowChanging;
            
            public event AppDataRowChangeEventHandler AppDataRowDeleted;
            
            public event AppDataRowChangeEventHandler AppDataRowDeleting;
            
            public void AddAppDataRow(AppDataRow row) {
                this.Rows.Add(row);
            }
            
            public AppDataRow AddAppDataRow(string Text, int Number) {
                AppDataRow rowAppDataRow = ((AppDataRow)(this.NewRow()));
                rowAppDataRow.ItemArray = new object[] {
                        Text,
                        Number,
                        null};
                this.Rows.Add(rowAppDataRow);
                return rowAppDataRow;
            }
            
            public System.Collections.IEnumerator GetEnumerator() {
                return this.Rows.GetEnumerator();
            }
            
            public override DataTable Clone() {
                AppDataDataTable cln = ((AppDataDataTable)(base.Clone()));
                cln.InitVars();
                return cln;
            }
            
            protected override DataTable CreateInstance() {
                return new AppDataDataTable();
            }
            
            internal void InitVars() {
                this.columnText = this.Columns["Text"];
                this.columnNumber = this.Columns["Number"];
                this.columnAppData_Id = this.Columns["AppData_Id"];
            }
            
            private void InitClass() {
                this.columnText = new DataColumn("Text", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnText);
                this.columnNumber = new DataColumn("Number", typeof(int), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnNumber);
                this.columnAppData_Id = new DataColumn("AppData_Id", typeof(int), null, System.Data.MappingType.Hidden);
                this.Columns.Add(this.columnAppData_Id);
                this.Constraints.Add(new UniqueConstraint("Constraint1", new DataColumn[] {
                                this.columnAppData_Id}, true));
                this.columnNumber.AllowDBNull = false;
                this.columnAppData_Id.AutoIncrement = true;
                this.columnAppData_Id.AllowDBNull = false;
                this.columnAppData_Id.Unique = true;
            }
            
            public AppDataRow NewAppDataRow() {
                return ((AppDataRow)(this.NewRow()));
            }
            
            protected override DataRow NewRowFromBuilder(DataRowBuilder builder) {
                return new AppDataRow(builder);
            }
            
            protected override System.Type GetRowType() {
                return typeof(AppDataRow);
            }
            
            protected override void OnRowChanged(DataRowChangeEventArgs e) {
                base.OnRowChanged(e);
                if ((this.AppDataRowChanged != null)) {
                    this.AppDataRowChanged(this, new AppDataRowChangeEvent(((AppDataRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowChanging(DataRowChangeEventArgs e) {
                base.OnRowChanging(e);
                if ((this.AppDataRowChanging != null)) {
                    this.AppDataRowChanging(this, new AppDataRowChangeEvent(((AppDataRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleted(DataRowChangeEventArgs e) {
                base.OnRowDeleted(e);
                if ((this.AppDataRowDeleted != null)) {
                    this.AppDataRowDeleted(this, new AppDataRowChangeEvent(((AppDataRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleting(DataRowChangeEventArgs e) {
                base.OnRowDeleting(e);
                if ((this.AppDataRowDeleting != null)) {
                    this.AppDataRowDeleting(this, new AppDataRowChangeEvent(((AppDataRow)(e.Row)), e.Action));
                }
            }
            
            public void RemoveAppDataRow(AppDataRow row) {
                this.Rows.Remove(row);
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class AppDataRow : DataRow {
            
            private AppDataDataTable tableAppData;
            
            internal AppDataRow(DataRowBuilder rb) : 
                    base(rb) {
                this.tableAppData = ((AppDataDataTable)(this.Table));
            }
            
            public string Text {
                get {
                    try {
                        return ((string)(this[this.tableAppData.TextColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("Cannot get value because it is DBNull.", e);
                    }
                }
                set {
                    this[this.tableAppData.TextColumn] = value;
                }
            }
            
            public int Number {
                get {
                    return ((int)(this[this.tableAppData.NumberColumn]));
                }
                set {
                    this[this.tableAppData.NumberColumn] = value;
                }
            }
            
            public bool IsTextNull() {
                return this.IsNull(this.tableAppData.TextColumn);
            }
            
            public void SetTextNull() {
                this[this.tableAppData.TextColumn] = System.Convert.DBNull;
            }
            
            public Section1Row[] GetSection1Rows() {
                return ((Section1Row[])(this.GetChildRows(this.Table.ChildRelations["AppData_Section1"])));
            }
            
            public ItemsRow[] GetItemsRows() {
                return ((ItemsRow[])(this.GetChildRows(this.Table.ChildRelations["AppData_Items"])));
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class AppDataRowChangeEvent : EventArgs {
            
            private AppDataRow eventRow;
            
            private DataRowAction eventAction;
            
            public AppDataRowChangeEvent(AppDataRow row, DataRowAction action) {
                this.eventRow = row;
                this.eventAction = action;
            }
            
            public AppDataRow Row {
                get {
                    return this.eventRow;
                }
            }
            
            public DataRowAction Action {
                get {
                    return this.eventAction;
                }
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class Section1DataTable : DataTable, System.Collections.IEnumerable {
            
            private DataColumn columnText1;
            
            private DataColumn columnNumber1;
            
            private DataColumn columnAppData_Id;
            
            internal Section1DataTable() : 
                    base("Section1") {
                this.InitClass();
            }
            
            internal Section1DataTable(DataTable table) : 
                    base(table.TableName) {
                if ((table.CaseSensitive != table.DataSet.CaseSensitive)) {
                    this.CaseSensitive = table.CaseSensitive;
                }
                if ((table.Locale.ToString() != table.DataSet.Locale.ToString())) {
                    this.Locale = table.Locale;
                }
                if ((table.Namespace != table.DataSet.Namespace)) {
                    this.Namespace = table.Namespace;
                }
                this.Prefix = table.Prefix;
                this.MinimumCapacity = table.MinimumCapacity;
                this.DisplayExpression = table.DisplayExpression;
            }
            
            [System.ComponentModel.Browsable(false)]
            public int Count {
                get {
                    return this.Rows.Count;
                }
            }
            
            internal DataColumn Text1Column {
                get {
                    return this.columnText1;
                }
            }
            
            internal DataColumn Number1Column {
                get {
                    return this.columnNumber1;
                }
            }
            
            internal DataColumn AppData_IdColumn {
                get {
                    return this.columnAppData_Id;
                }
            }
            
            public Section1Row this[int index] {
                get {
                    return ((Section1Row)(this.Rows[index]));
                }
            }
            
            public event Section1RowChangeEventHandler Section1RowChanged;
            
            public event Section1RowChangeEventHandler Section1RowChanging;
            
            public event Section1RowChangeEventHandler Section1RowDeleted;
            
            public event Section1RowChangeEventHandler Section1RowDeleting;
            
            public void AddSection1Row(Section1Row row) {
                this.Rows.Add(row);
            }
            
            public Section1Row AddSection1Row(string Text1, int Number1, AppDataRow parentAppDataRowByAppData_Section1) {
                Section1Row rowSection1Row = ((Section1Row)(this.NewRow()));
                rowSection1Row.ItemArray = new object[] {
                        Text1,
                        Number1,
                        parentAppDataRowByAppData_Section1[2]};
                this.Rows.Add(rowSection1Row);
                return rowSection1Row;
            }
            
            public System.Collections.IEnumerator GetEnumerator() {
                return this.Rows.GetEnumerator();
            }
            
            public override DataTable Clone() {
                Section1DataTable cln = ((Section1DataTable)(base.Clone()));
                cln.InitVars();
                return cln;
            }
            
            protected override DataTable CreateInstance() {
                return new Section1DataTable();
            }
            
            internal void InitVars() {
                this.columnText1 = this.Columns["Text1"];
                this.columnNumber1 = this.Columns["Number1"];
                this.columnAppData_Id = this.Columns["AppData_Id"];
            }
            
            private void InitClass() {
                this.columnText1 = new DataColumn("Text1", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnText1);
                this.columnNumber1 = new DataColumn("Number1", typeof(int), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnNumber1);
                this.columnAppData_Id = new DataColumn("AppData_Id", typeof(int), null, System.Data.MappingType.Hidden);
                this.Columns.Add(this.columnAppData_Id);
                this.columnNumber1.AllowDBNull = false;
            }
            
            public Section1Row NewSection1Row() {
                return ((Section1Row)(this.NewRow()));
            }
            
            protected override DataRow NewRowFromBuilder(DataRowBuilder builder) {
                return new Section1Row(builder);
            }
            
            protected override System.Type GetRowType() {
                return typeof(Section1Row);
            }
            
            protected override void OnRowChanged(DataRowChangeEventArgs e) {
                base.OnRowChanged(e);
                if ((this.Section1RowChanged != null)) {
                    this.Section1RowChanged(this, new Section1RowChangeEvent(((Section1Row)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowChanging(DataRowChangeEventArgs e) {
                base.OnRowChanging(e);
                if ((this.Section1RowChanging != null)) {
                    this.Section1RowChanging(this, new Section1RowChangeEvent(((Section1Row)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleted(DataRowChangeEventArgs e) {
                base.OnRowDeleted(e);
                if ((this.Section1RowDeleted != null)) {
                    this.Section1RowDeleted(this, new Section1RowChangeEvent(((Section1Row)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleting(DataRowChangeEventArgs e) {
                base.OnRowDeleting(e);
                if ((this.Section1RowDeleting != null)) {
                    this.Section1RowDeleting(this, new Section1RowChangeEvent(((Section1Row)(e.Row)), e.Action));
                }
            }
            
            public void RemoveSection1Row(Section1Row row) {
                this.Rows.Remove(row);
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class Section1Row : DataRow {
            
            private Section1DataTable tableSection1;
            
            internal Section1Row(DataRowBuilder rb) : 
                    base(rb) {
                this.tableSection1 = ((Section1DataTable)(this.Table));
            }
            
            public string Text1 {
                get {
                    try {
                        return ((string)(this[this.tableSection1.Text1Column]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("Cannot get value because it is DBNull.", e);
                    }
                }
                set {
                    this[this.tableSection1.Text1Column] = value;
                }
            }
            
            public int Number1 {
                get {
                    return ((int)(this[this.tableSection1.Number1Column]));
                }
                set {
                    this[this.tableSection1.Number1Column] = value;
                }
            }
            
            public AppDataRow AppDataRow {
                get {
                    return ((AppDataRow)(this.GetParentRow(this.Table.ParentRelations["AppData_Section1"])));
                }
                set {
                    this.SetParentRow(value, this.Table.ParentRelations["AppData_Section1"]);
                }
            }
            
            public bool IsText1Null() {
                return this.IsNull(this.tableSection1.Text1Column);
            }
            
            public void SetText1Null() {
                this[this.tableSection1.Text1Column] = System.Convert.DBNull;
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class Section1RowChangeEvent : EventArgs {
            
            private Section1Row eventRow;
            
            private DataRowAction eventAction;
            
            public Section1RowChangeEvent(Section1Row row, DataRowAction action) {
                this.eventRow = row;
                this.eventAction = action;
            }
            
            public Section1Row Row {
                get {
                    return this.eventRow;
                }
            }
            
            public DataRowAction Action {
                get {
                    return this.eventAction;
                }
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class ItemsDataTable : DataTable, System.Collections.IEnumerable {
            
            private DataColumn columnItems_Id;
            
            private DataColumn columnAppData_Id;
            
            internal ItemsDataTable() : 
                    base("Items") {
                this.InitClass();
            }
            
            internal ItemsDataTable(DataTable table) : 
                    base(table.TableName) {
                if ((table.CaseSensitive != table.DataSet.CaseSensitive)) {
                    this.CaseSensitive = table.CaseSensitive;
                }
                if ((table.Locale.ToString() != table.DataSet.Locale.ToString())) {
                    this.Locale = table.Locale;
                }
                if ((table.Namespace != table.DataSet.Namespace)) {
                    this.Namespace = table.Namespace;
                }
                this.Prefix = table.Prefix;
                this.MinimumCapacity = table.MinimumCapacity;
                this.DisplayExpression = table.DisplayExpression;
            }
            
            [System.ComponentModel.Browsable(false)]
            public int Count {
                get {
                    return this.Rows.Count;
                }
            }
            
            internal DataColumn Items_IdColumn {
                get {
                    return this.columnItems_Id;
                }
            }
            
            internal DataColumn AppData_IdColumn {
                get {
                    return this.columnAppData_Id;
                }
            }
            
            public ItemsRow this[int index] {
                get {
                    return ((ItemsRow)(this.Rows[index]));
                }
            }
            
            public event ItemsRowChangeEventHandler ItemsRowChanged;
            
            public event ItemsRowChangeEventHandler ItemsRowChanging;
            
            public event ItemsRowChangeEventHandler ItemsRowDeleted;
            
            public event ItemsRowChangeEventHandler ItemsRowDeleting;
            
            public void AddItemsRow(ItemsRow row) {
                this.Rows.Add(row);
            }
            
            public ItemsRow AddItemsRow(AppDataRow parentAppDataRowByAppData_Items) {
                ItemsRow rowItemsRow = ((ItemsRow)(this.NewRow()));
                rowItemsRow.ItemArray = new object[] {
                        null,
                        parentAppDataRowByAppData_Items[2]};
                this.Rows.Add(rowItemsRow);
                return rowItemsRow;
            }
            
            public System.Collections.IEnumerator GetEnumerator() {
                return this.Rows.GetEnumerator();
            }
            
            public override DataTable Clone() {
                ItemsDataTable cln = ((ItemsDataTable)(base.Clone()));
                cln.InitVars();
                return cln;
            }
            
            protected override DataTable CreateInstance() {
                return new ItemsDataTable();
            }
            
            internal void InitVars() {
                this.columnItems_Id = this.Columns["Items_Id"];
                this.columnAppData_Id = this.Columns["AppData_Id"];
            }
            
            private void InitClass() {
                this.columnItems_Id = new DataColumn("Items_Id", typeof(int), null, System.Data.MappingType.Hidden);
                this.Columns.Add(this.columnItems_Id);
                this.columnAppData_Id = new DataColumn("AppData_Id", typeof(int), null, System.Data.MappingType.Hidden);
                this.Columns.Add(this.columnAppData_Id);
                this.Constraints.Add(new UniqueConstraint("Constraint1", new DataColumn[] {
                                this.columnItems_Id}, true));
                this.columnItems_Id.AutoIncrement = true;
                this.columnItems_Id.AllowDBNull = false;
                this.columnItems_Id.Unique = true;
            }
            
            public ItemsRow NewItemsRow() {
                return ((ItemsRow)(this.NewRow()));
            }
            
            protected override DataRow NewRowFromBuilder(DataRowBuilder builder) {
                return new ItemsRow(builder);
            }
            
            protected override System.Type GetRowType() {
                return typeof(ItemsRow);
            }
            
            protected override void OnRowChanged(DataRowChangeEventArgs e) {
                base.OnRowChanged(e);
                if ((this.ItemsRowChanged != null)) {
                    this.ItemsRowChanged(this, new ItemsRowChangeEvent(((ItemsRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowChanging(DataRowChangeEventArgs e) {
                base.OnRowChanging(e);
                if ((this.ItemsRowChanging != null)) {
                    this.ItemsRowChanging(this, new ItemsRowChangeEvent(((ItemsRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleted(DataRowChangeEventArgs e) {
                base.OnRowDeleted(e);
                if ((this.ItemsRowDeleted != null)) {
                    this.ItemsRowDeleted(this, new ItemsRowChangeEvent(((ItemsRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleting(DataRowChangeEventArgs e) {
                base.OnRowDeleting(e);
                if ((this.ItemsRowDeleting != null)) {
                    this.ItemsRowDeleting(this, new ItemsRowChangeEvent(((ItemsRow)(e.Row)), e.Action));
                }
            }
            
            public void RemoveItemsRow(ItemsRow row) {
                this.Rows.Remove(row);
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class ItemsRow : DataRow {
            
            private ItemsDataTable tableItems;
            
            internal ItemsRow(DataRowBuilder rb) : 
                    base(rb) {
                this.tableItems = ((ItemsDataTable)(this.Table));
            }
            
            public AppDataRow AppDataRow {
                get {
                    return ((AppDataRow)(this.GetParentRow(this.Table.ParentRelations["AppData_Items"])));
                }
                set {
                    this.SetParentRow(value, this.Table.ParentRelations["AppData_Items"]);
                }
            }
            
            public _ItemRow[] GetItemRows() {
                return ((_ItemRow[])(this.GetChildRows(this.Table.ChildRelations["Items_Item"])));
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class ItemsRowChangeEvent : EventArgs {
            
            private ItemsRow eventRow;
            
            private DataRowAction eventAction;
            
            public ItemsRowChangeEvent(ItemsRow row, DataRowAction action) {
                this.eventRow = row;
                this.eventAction = action;
            }
            
            public ItemsRow Row {
                get {
                    return this.eventRow;
                }
            }
            
            public DataRowAction Action {
                get {
                    return this.eventAction;
                }
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class _ItemDataTable : DataTable, System.Collections.IEnumerable {
            
            private DataColumn columnID;
            
            private DataColumn columnName;
            
            private DataColumn columnItems_Id;
            
            internal _ItemDataTable() : 
                    base("Item") {
                this.InitClass();
            }
            
            internal _ItemDataTable(DataTable table) : 
                    base(table.TableName) {
                if ((table.CaseSensitive != table.DataSet.CaseSensitive)) {
                    this.CaseSensitive = table.CaseSensitive;
                }
                if ((table.Locale.ToString() != table.DataSet.Locale.ToString())) {
                    this.Locale = table.Locale;
                }
                if ((table.Namespace != table.DataSet.Namespace)) {
                    this.Namespace = table.Namespace;
                }
                this.Prefix = table.Prefix;
                this.MinimumCapacity = table.MinimumCapacity;
                this.DisplayExpression = table.DisplayExpression;
            }
            
            [System.ComponentModel.Browsable(false)]
            public int Count {
                get {
                    return this.Rows.Count;
                }
            }
            
            internal DataColumn IDColumn {
                get {
                    return this.columnID;
                }
            }
            
            internal DataColumn NameColumn {
                get {
                    return this.columnName;
                }
            }
            
            internal DataColumn Items_IdColumn {
                get {
                    return this.columnItems_Id;
                }
            }
            
            public _ItemRow this[int index] {
                get {
                    return ((_ItemRow)(this.Rows[index]));
                }
            }
            
            public event _ItemRowChangeEventHandler _ItemRowChanged;
            
            public event _ItemRowChangeEventHandler _ItemRowChanging;
            
            public event _ItemRowChangeEventHandler _ItemRowDeleted;
            
            public event _ItemRowChangeEventHandler _ItemRowDeleting;
            
            public void Add_ItemRow(_ItemRow row) {
                this.Rows.Add(row);
            }
            
            public _ItemRow Add_ItemRow(int ID, string Name, ItemsRow parentItemsRowByItems_Item) {
                _ItemRow row_ItemRow = ((_ItemRow)(this.NewRow()));
                row_ItemRow.ItemArray = new object[] {
                        ID,
                        Name,
                        parentItemsRowByItems_Item[0]};
                this.Rows.Add(row_ItemRow);
                return row_ItemRow;
            }
            
            public System.Collections.IEnumerator GetEnumerator() {
                return this.Rows.GetEnumerator();
            }
            
            public override DataTable Clone() {
                _ItemDataTable cln = ((_ItemDataTable)(base.Clone()));
                cln.InitVars();
                return cln;
            }
            
            protected override DataTable CreateInstance() {
                return new _ItemDataTable();
            }
            
            internal void InitVars() {
                this.columnID = this.Columns["ID"];
                this.columnName = this.Columns["Name"];
                this.columnItems_Id = this.Columns["Items_Id"];
            }
            
            private void InitClass() {
                this.columnID = new DataColumn("ID", typeof(int), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnID);
                this.columnName = new DataColumn("Name", typeof(string), null, System.Data.MappingType.Element);
                this.Columns.Add(this.columnName);
                this.columnItems_Id = new DataColumn("Items_Id", typeof(int), null, System.Data.MappingType.Hidden);
                this.Columns.Add(this.columnItems_Id);
                this.columnID.AllowDBNull = false;
            }
            
            public _ItemRow New_ItemRow() {
                return ((_ItemRow)(this.NewRow()));
            }
            
            protected override DataRow NewRowFromBuilder(DataRowBuilder builder) {
                return new _ItemRow(builder);
            }
            
            protected override System.Type GetRowType() {
                return typeof(_ItemRow);
            }
            
            protected override void OnRowChanged(DataRowChangeEventArgs e) {
                base.OnRowChanged(e);
                if ((this._ItemRowChanged != null)) {
                    this._ItemRowChanged(this, new _ItemRowChangeEvent(((_ItemRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowChanging(DataRowChangeEventArgs e) {
                base.OnRowChanging(e);
                if ((this._ItemRowChanging != null)) {
                    this._ItemRowChanging(this, new _ItemRowChangeEvent(((_ItemRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleted(DataRowChangeEventArgs e) {
                base.OnRowDeleted(e);
                if ((this._ItemRowDeleted != null)) {
                    this._ItemRowDeleted(this, new _ItemRowChangeEvent(((_ItemRow)(e.Row)), e.Action));
                }
            }
            
            protected override void OnRowDeleting(DataRowChangeEventArgs e) {
                base.OnRowDeleting(e);
                if ((this._ItemRowDeleting != null)) {
                    this._ItemRowDeleting(this, new _ItemRowChangeEvent(((_ItemRow)(e.Row)), e.Action));
                }
            }
            
            public void Remove_ItemRow(_ItemRow row) {
                this.Rows.Remove(row);
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class _ItemRow : DataRow {
            
            private _ItemDataTable table_Item;
            
            internal _ItemRow(DataRowBuilder rb) : 
                    base(rb) {
                this.table_Item = ((_ItemDataTable)(this.Table));
            }
            
            public int ID {
                get {
                    return ((int)(this[this.table_Item.IDColumn]));
                }
                set {
                    this[this.table_Item.IDColumn] = value;
                }
            }
            
            public string Name {
                get {
                    try {
                        return ((string)(this[this.table_Item.NameColumn]));
                    }
                    catch (InvalidCastException e) {
                        throw new StrongTypingException("Cannot get value because it is DBNull.", e);
                    }
                }
                set {
                    this[this.table_Item.NameColumn] = value;
                }
            }
            
            public ItemsRow ItemsRow {
                get {
                    return ((ItemsRow)(this.GetParentRow(this.Table.ParentRelations["Items_Item"])));
                }
                set {
                    this.SetParentRow(value, this.Table.ParentRelations["Items_Item"]);
                }
            }
            
            public bool IsNameNull() {
                return this.IsNull(this.table_Item.NameColumn);
            }
            
            public void SetNameNull() {
                this[this.table_Item.NameColumn] = System.Convert.DBNull;
            }
        }
        
        [System.Diagnostics.DebuggerStepThrough()]
        public class _ItemRowChangeEvent : EventArgs {
            
            private _ItemRow eventRow;
            
            private DataRowAction eventAction;
            
            public _ItemRowChangeEvent(_ItemRow row, DataRowAction action) {
                this.eventRow = row;
                this.eventAction = action;
            }
            
            public _ItemRow Row {
                get {
                    return this.eventRow;
                }
            }
            
            public DataRowAction Action {
                get {
                    return this.eventAction;
                }
            }
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Gabriel Szabo
Software Developer (Senior)
Slovakia Slovakia
No Biography provided

| Advertise | Privacy | Mobile
Web04 | 2.8.141015.1 | Last Updated 9 Nov 2004
Article Copyright 2004 by Gabriel Szabo
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid