System.Data.TableMappingCollection.Add C# (CSharp) Method

Add() public method

public Add ( TableMapping map ) : void
map TableMapping
return void
		public void Add (TableMapping map)
		{
			this.List.Add (map);
		}

Usage Example

        private TableMapping GetMappedTable(TableMapping parent, string tableName, string ns)
        {
            TableMapping map = tables [tableName];

            if (map != null)
            {
                if (parent != null && map.ParentTable != null && map.ParentTable != parent)
                {
                    throw new DataException(String.Format("The table '{0}' is already allocated as a child of another table '{1}'. Cannot set table '{2}' as parent table.", tableName, map.ParentTable.Table.TableName, parent.Table.TableName));
                }
            }
            else
            {
                map             = new TableMapping(tableName, ns);
                map.ParentTable = parent;
                tables.Add(map);
            }
            if (parent != null)
            {
                bool shouldAdd = true;
                foreach (TableMapping child in parent.ChildTables)
                {
                    if (child.Table.TableName == tableName)
                    {
                        shouldAdd = false;
                        break;
                    }
                }
                if (shouldAdd)
                {
                    parent.ChildTables.Add(map);
                }
            }
            return(map);
        }
TableMappingCollection