Inheritance: InternalDataCollectionBase
コード例 #1
0
        public XmlSchemaWriter(DataSet dataset,
                               XmlWriter writer, DataTableCollection tables,
                               DataRelationCollection relations)
        {
            dataSetName      = dataset.DataSetName;
            dataSetNamespace = dataset.Namespace;
#if NET_2_0
            dataSetLocale = dataset.LocaleSpecified ? dataset.Locale : null;
#else
            dataSetLocale = dataset.Locale;
#endif
            dataSetProperties = dataset.ExtendedProperties;
            w = writer;
            if (tables != null)
            {
                this.tables = new DataTable[tables.Count];
                for (int i = 0; i < tables.Count; i++)
                {
                    this.tables[i] = tables[i];
                }
            }
            if (relations != null)
            {
                this.relations = new DataRelation[relations.Count];
                for (int i = 0; i < relations.Count; i++)
                {
                    this.relations[i] = relations[i];
                }
            }
        }
コード例 #2
0
		public static void WriteXmlSchema (DataSet dataset,
			XmlWriter writer, DataTableCollection tables,
			DataRelationCollection relations)
		{
			new XmlSchemaWriter (dataset, writer,
				tables, relations).WriteSchema ();
		}
コード例 #3
0
 public static void WriteXmlSchema(DataSet dataset,
                                   XmlWriter writer, DataTableCollection tables,
                                   DataRelationCollection relations)
 {
     new XmlSchemaWriter(dataset, writer,
                         tables, relations).WriteSchema();
 }
コード例 #4
0
 public DataSet(string dataSetName)
 {
     this.dataSetName   = dataSetName;
     tableCollection    = new DataTableCollection(this);
     relationCollection = new DataRelationCollection.DataSetRelationCollection(this);
     properties         = new PropertyCollection();
     prefix             = String.Empty;
 }
コード例 #5
0
		public XmlSchemaWriter (DataSet dataset,
			XmlWriter writer, DataTableCollection tables,
			DataRelationCollection relations)
		{
			ds = dataset;
			w = writer;
			this.tables = tables;
			this.relations = relations;
		}
コード例 #6
0
ファイル: DataSet.cs プロジェクト: dotnet/corefx
        internal bool _udtIsWrapped; // if UDT is wrapped , for YUKON

        /// <summary>
        /// Initializes a new instance of the <see cref='System.Data.DataSet'/> class.
        /// </summary>
        public DataSet()
        {
            GC.SuppressFinalize(this);
            DataCommonEventSource.Log.Trace("<ds.DataSet.DataSet|API> {0}", ObjectID); // others will call this constr

            // Set default locale
            _tableCollection = new DataTableCollection(this);
            _relationCollection = new DataRelationCollection.DataSetRelationCollection(this);
            _culture = CultureInfo.CurrentCulture; // Set default locale
        }
コード例 #7
0
		public DataSet (string name)
		{
			dataSetName = name;
			tableCollection = new DataTableCollection (this);
			relationCollection = new DataRelationCollection.DataSetRelationCollection (this);
			properties = new PropertyCollection ();
			this.prefix = String.Empty;
			
			this.Locale = CultureInfo.CurrentCulture;
		}
コード例 #8
0
ファイル: fmSelectProvideru.cs プロジェクト: san90279/UK_OAS
 private void GenRelationBindingSource(DataRelationCollection Relations, TreeNode ParentNode)
 {
     foreach (DataRelation Relation in Relations)
     {
         TreeNode ChildNode = null;
         if (ParentNode.Text == Relation.ParentTable.ToString())
             ChildNode = ParentNode.Nodes.Add(Relation.ChildTable.TableName);
         GenRelationBindingSource(Relation.ChildTable.ChildRelations, ChildNode);
     }
 }
コード例 #9
0
        internal override void Bind(DataTable table, List <DataColumn> list)
        {
            base.BindTable(table);
            if (table == null)
            {
                throw ExprException.AggregateUnbound(this.ToString());
            }
            if (this.local)
            {
                this.relation = null;
            }
            else
            {
                DataRelationCollection childRelations = table.ChildRelations;
                if (this.relationName == null)
                {
                    if (childRelations.Count > 1)
                    {
                        throw ExprException.UnresolvedRelation(table.TableName, this.ToString());
                    }
                    if (childRelations.Count != 1)
                    {
                        throw ExprException.AggregateUnbound(this.ToString());
                    }
                    this.relation = childRelations[0];
                }
                else
                {
                    this.relation = childRelations[this.relationName];
                }
            }
            this.childTable = (this.relation == null) ? table : this.relation.ChildTable;
            this.column     = this.childTable.Columns[this.columnName];
            if (this.column == null)
            {
                throw ExprException.UnboundName(this.columnName);
            }
            int num = 0;

            while (num < list.Count)
            {
                DataColumn column = list[num];
                if (this.column == column)
                {
                    break;
                }
                num++;
            }
            if (num >= list.Count)
            {
                list.Add(this.column);
            }
            Bind(this.relation, list);
        }
コード例 #10
0
        internal DataRelation FindParentRelation()
        {
            DataRelationCollection rels = Table.ParentRelations;

            for (int i = 0; i < rels.Count; i++)
            {
                if (rels[i].ChildKeyConstraint == this)
                {
                    return(rels[i]);
                }
            }
            return(null);
        }
コード例 #11
0
        internal override void Bind(DataTable table, List <DataColumn> list)
        {
            base.BindTable(table);
            this.column   = null;
            this.relation = null;
            if (table == null)
            {
                throw ExprException.ExpressionUnbound(this.ToString());
            }
            DataRelationCollection parentRelations = table.ParentRelations;

            if (this.relationName == null)
            {
                if (parentRelations.Count > 1)
                {
                    throw ExprException.UnresolvedRelation(table.TableName, this.ToString());
                }
                this.relation = parentRelations[0];
            }
            else
            {
                this.relation = parentRelations[this.relationName];
            }
            if (this.relation == null)
            {
                throw ExprException.BindFailure(this.relationName);
            }
            DataTable parentTable = this.relation.ParentTable;

            this.column = parentTable.Columns[this.columnName];
            if (this.column == null)
            {
                throw ExprException.UnboundName(this.columnName);
            }
            int num = 0;

            while (num < list.Count)
            {
                DataColumn column = list[num];
                if (this.column == column)
                {
                    break;
                }
                num++;
            }
            if (num >= list.Count)
            {
                list.Add(this.column);
            }
            AggregateNode.Bind(this.relation, list);
        }
コード例 #12
0
 public DataSet()
 {
     this.dataSetName = "NewDataSet";
     this._datasetPrefix = string.Empty;
     this.namespaceURI = string.Empty;
     this.enforceConstraints = true;
     this.fEnableCascading = true;
     this.mainTableName = "";
     this._defaultViewManagerLock = new object();
     this._objectID = Interlocked.Increment(ref _objectTypeCount);
     GC.SuppressFinalize(this);
     Bid.Trace("<ds.DataSet.DataSet|API> %d#\n", this.ObjectID);
     this.tableCollection = new DataTableCollection(this);
     this.relationCollection = new DataRelationCollection.DataSetRelationCollection(this);
     this._culture = CultureInfo.CurrentCulture;
 }
コード例 #13
0
ファイル: XmlSchemaWriter.cs プロジェクト: t-ashula/mono
		public XmlSchemaWriter (DataSet dataset,
			XmlWriter writer, DataTableCollection tables,
			DataRelationCollection relations)
		{
			dataSetName = dataset.DataSetName;
			dataSetNamespace = dataset.Namespace;
			dataSetLocale = dataset.LocaleSpecified ? dataset.Locale : null;
			dataSetProperties = dataset.ExtendedProperties;
			w = writer;
			if (tables != null) {
				this.tables = new DataTable[tables.Count];
				for(int i=0;i<tables.Count;i++) this.tables[i] = tables[i];
			}
			if (relations != null) {
				this.relations = new DataRelation[relations.Count];
				for(int i=0;i<relations.Count;i++) this.relations[i] = relations[i];
			}
		}
コード例 #14
0
ファイル: XmlDataReader.cs プロジェクト: raj581/Marvin
        private void ReadElementElement(DataRow row)
        {
            // This child element (for row) might be either simple
            // content element, or child element

            // MS.NET crashes here... but it seems just a bug.
            DataColumn col = row.Table.Columns [XmlHelper.Decode(reader.LocalName)];

            if (col == null || col.Namespace != reader.NamespaceURI)
            {
                col = null;
            }

            // if col exists, then it should be MappingType.Element
            if (col != null &&
                col.ColumnMapping == MappingType.Element)
            {
                // TODO: This part is suspicious for
                // MS compatibility (test required)
                if (col.Namespace != reader.NamespaceURI)
                {
                    reader.Skip();
                    return;
                }

                bool wasEmpty = reader.IsEmptyElement;
                int  depth    = reader.Depth;

                if (typeof(IXmlSerializable).IsAssignableFrom(col.DataType))
                {
#if NET_2_0
                    try {
                        // NOTE: ReadElementString works fine with proper XML with CDATA etc,
                        // however doesn't behave well with XMLs like the one in
                        // https://bugzilla.novell.com/show_bug.cgi?id=377146 which is
                        // apparently supported by MS.NET - to maintain compatibility,
                        // If the obj implements IXmlSerializable, let obj's ReadXml do the reading
                        IXmlSerializable obj = (IXmlSerializable)Activator.CreateInstance(col.DataType, new object [0]);
                        if (!reader.IsEmptyElement)
                        {
                            obj.ReadXml(reader);
                            reader.ReadEndElement();
                        }
                        else
                        {
                            reader.Skip();
                        }
                        row [col] = obj;
                    } catch (XmlException e) {
#endif
                    // XML is not in accordance to expected standards, try reading the content as an xml doc
                    row [col] = reader.ReadInnerXml();
#if NET_2_0
                }
                catch (InvalidOperationException e) {
                    row [col] = reader.ReadInnerXml();
                }
#endif
                }
                else
                {
                    row [col] = StringToObject(col.DataType, reader.ReadElementString());
                }

                if (!wasEmpty && reader.Depth > depth)
                {
                    // This means, instance does not match with
                    // the schema (because the instance element
                    // contains complex content, while specified as
                    // simple), so just skip to the end of the
                    // element.
                    while (reader.Depth > depth)
                    {
                        reader.Read();
                    }
                    reader.Read();
                }
                reader.MoveToContent();
                return;
            }
            else if (col != null)
            {
                // Mismatch column type. Just skip
                reader.Skip();
                reader.MoveToContent();
                return;
            }

            // Otherwise, it might be child table element
            DataRelationCollection rels = row.Table.ChildRelations;
            for (int i = 0; i < rels.Count; i++)
            {
                DataRelation rel = rels [i];
                if (!rel.Nested)
                {
                    continue;
                }
                DataTable ct = rel.ChildTable;
                if (ct.TableName != XmlHelper.Decode(reader.LocalName) || ct.Namespace != reader.NamespaceURI)
                {
                    continue;
                }

                DataRow childRow = rel.ChildTable.NewRow();
                ReadElement(childRow);

                for (int c = 0; c < rel.ChildColumns.Length; c++)
                {
                    childRow [rel.ChildColumns [c]]
                        = row [rel.ParentColumns [c]];
                }
                rel.ChildTable.Rows.Add(childRow);
                return;
            }

            // Matched neither of the above: just skip
            reader.Skip();
            reader.MoveToContent();
        }
コード例 #15
0
ファイル: DataTable.cs プロジェクト: shana/mono
		/// <summary>
		/// Initializes a new instance of the DataTable class with no arguments.
		/// </summary>
		public DataTable ()
		{
			dataSet = null;
			_columnCollection = new DataColumnCollection(this);
			_constraintCollection = new ConstraintCollection(this);
			_extendedProperties = new PropertyCollection();
			_tableName = "";
			_nameSpace = null;
			_caseSensitive = false;	 	//default value
			_displayExpression = null;
			_primaryKeyConstraint = null;
			_site = null;
			_rows = new DataRowCollection (this);
			_indexes = new ArrayList();
			_recordCache = new RecordCache(this);

			//LAMESPEC: spec says 25 impl does 50
			_minimumCapacity = 50;

			_childRelations = new DataRelationCollection.DataTableRelationCollection (this);
			_parentRelations = new DataRelationCollection.DataTableRelationCollection (this);
		}
コード例 #16
0
        internal DataTable InstantiateTable(DataSet dataSet, XmlElement node, XmlElement typeNode)
        {
            string typeName = "";
            XmlAttributeCollection attrs = node.Attributes;
            DataTable table;
            int       minOccurs     = 1;
            int       maxOccurs     = 1;
            string    keys          = null;
            ArrayList tableChildren = new ArrayList();



            if (attrs.Count > 0)
            {
                typeName = GetInstanceName(node);
                table    = dataSet.Tables.GetTable(typeName, _schemaUri);
                if (table != null)
                {
                    return(table);
                }
            }

            table = new DataTable(XmlConvert.DecodeName(typeName));
            // fxcop: new DataTable should inherit the CaseSensitive, Locale from DataSet and possibly updating during SetProperties

            table.Namespace = _schemaUri;

            GetMinMax(node, ref minOccurs, ref maxOccurs);
            table.MinOccurs = minOccurs;
            table.MaxOccurs = maxOccurs;

            _ds.Tables.Add(table);

            HandleTypeNode(typeNode, table, tableChildren);

            SetProperties(table, attrs);

            // check to see if we fave unique constraint

            if (keys != null)
            {
                string[] list      = keys.TrimEnd(null).Split(null);
                int      keyLength = list.Length;

                DataColumn[] cols = new DataColumn[keyLength];

                for (int i = 0; i < keyLength; i++)
                {
                    DataColumn col = table.Columns[list[i], _schemaUri];
                    if (col == null)
                    {
                        throw ExceptionBuilder.ElementTypeNotFound(list[i]);
                    }
                    cols[i] = col;
                }
                table.PrimaryKey = cols;
            }


            foreach (DataTable _tableChild in tableChildren)
            {
                DataRelation relation = null;

                DataRelationCollection childRelations = table.ChildRelations;

                for (int j = 0; j < childRelations.Count; j++)
                {
                    if (!childRelations[j].Nested)
                    {
                        continue;
                    }

                    if (_tableChild == childRelations[j].ChildTable)
                    {
                        relation = childRelations[j];
                    }
                }

                if (relation != null)
                {
                    continue;
                }

                DataColumn parentKey = table.AddUniqueKey();
                // foreign key in the child table
                DataColumn childKey = _tableChild.AddForeignKey(parentKey);
                // create relationship
                // setup relationship between parent and this table
                relation = new DataRelation(table.TableName + "_" + _tableChild.TableName, parentKey, childKey, true);

                relation.CheckMultipleNested = false; // disable the check for multiple nested parent

                relation.Nested = true;
                _tableChild.DataSet.Relations.Add(relation);
                relation.CheckMultipleNested = true; // enable the check for multiple nested parent
            }

            return(table);
        }
コード例 #17
0
ファイル: DataSet.cs プロジェクト: t-ashula/mono
		public DataSet (string dataSetName)
		{
			this.dataSetName = dataSetName;
			tableCollection = new DataTableCollection (this);
			relationCollection = new DataRelationCollection.DataSetRelationCollection (this);
			properties = new PropertyCollection ();
			prefix = String.Empty;
		}
コード例 #18
0
ファイル: ColumnReference.cs プロジェクト: nlhepler/mono
		private void DropCached (DataColumnCollection columnCollection, DataRelationCollection relationCollection)
		{
			if (_cachedColumn != null) {
				// unregister column listener
				_cachedColumn.PropertyChanged -= new PropertyChangedEventHandler (OnColumnPropertyChanged);

				// unregister column collection listener
				if (columnCollection != null)	
					columnCollection.CollectionChanged -= new CollectionChangeEventHandler (OnColumnRemoved);
				else if (_cachedColumn.Table != null)
					_cachedColumn.Table.Columns.CollectionChanged -= new CollectionChangeEventHandler (OnColumnRemoved);
				
				_cachedColumn = null;
			}

			if (_cachedRelation != null) {
				// unregister relation collection listener
				if (relationCollection != null)				
					relationCollection.CollectionChanged -= new CollectionChangeEventHandler (OnRelationRemoved);
				else if (_cachedRelation.DataSet != null)
					_cachedRelation.DataSet.Relations.CollectionChanged -= new CollectionChangeEventHandler (OnRelationRemoved);

				_cachedRelation = null;
			}			
		}
コード例 #19
0
ファイル: fmJQueryWebForm.cs プロジェクト: san90279/UK_OAS
        private void ShowChildRelation(DataRelationCollection Relations, System.Windows.Forms.TreeNode Node)
        {
            System.Windows.Forms.TreeNode ChildNode;
            foreach (DataRelation R in Relations)
            {
                InfoBindingSource IBS = new InfoBindingSource();

                //if ((Node == null) || (Node.Level == 0))
                //{
                IBS.DataSource = FInfoDataSet;
                IBS.DataMember = FInfoDataSet.RealDataSet.Tables[0].TableName;
                //}
                //else
                //{
                //    TDetailItem item1 = (TDetailItem)Node.Parent.Tag;
                //    IBS.DataSource = item1.BindingSource;
                //    IBS.DataMember = item1.Relation.RelationName;
                //}
                ChildNode = new System.Windows.Forms.TreeNode();
                ChildNode.Text = R.ChildTable.TableName;
                ChildNode.Name = R.ChildTable.TableName;
                Node.Nodes.Add(ChildNode);
                SetNodeData(R, IBS, ChildNode);
                ShowChildRelation(R.ChildTable.ChildRelations, ChildNode);
            }
        }
コード例 #20
0
ファイル: ZDbViewCsForm.cs プロジェクト: zyl910/zdbviewcs
 /// <summary>
 /// 打印 DataRelationCollection .
 /// </summary>
 /// <param name="sb">输出缓冲区.</param>
 /// <param name="indent">缩进.</param>
 /// <param name="obj">对象.</param>
 public static void PrintDataRelationCollection(StringBuilder sb, int indent, DataRelationCollection obj)
 {
     int indentnext = indent + 1;
     String indentstr = GetIndentStr(indent);
     sb.AppendLine(string.Format("{0}# <{1}>", indentstr, obj.GetType().FullName));
     sb.AppendLine(string.Format("{0}# Count:\t{1}", indentstr, obj.Count));
     int i = 0;
     foreach (DataRelation p in obj) {
         sb.AppendLine(string.Format("{0}[{1}]:\t{2}", indentstr, i, p));
         PrintDataRelation(sb, indentnext, p);
         ++i;
     }
 }
コード例 #21
0
ファイル: fmExtClientWzdu.cs プロジェクト: san90279/UK_OAS
 private void GenRelationBindingSource(DataRelationCollection Relations, Object DataSource)
 {
     foreach (DataRelation Relation in Relations)
     {
         InfoBindingSource aBindingSource = FDesignerHost.CreateComponent(typeof(InfoBindingSource),
             "ibs" + Relation.ChildTable.TableName) as InfoBindingSource;
         aBindingSource.DataSource = DataSource;
         aBindingSource.DataMember = Relation.RelationName;
         aBindingSource.text = "ibs" + Relation.ChildTable.TableName;
         aBindingSource.Tablename = Relation.ChildTable.TableName;
         FBindingSourceList.Add(aBindingSource);
         GenRelationBindingSource(Relation.ChildTable.ChildRelations, aBindingSource);
     }
 }
コード例 #22
0
ファイル: fmExtClientWzdu.cs プロジェクト: san90279/UK_OAS
 private InfoDataSet DoGetRoot(InfoDataSet RootDataSet, DataRelationCollection Relations, String DataSetName)
 {
     foreach (DataRelation Relation in Relations)
     {
         if (Relation.ChildTable.TableName.CompareTo(DataSetName) == 0)
         {
             return RootDataSet;
         }
         DoGetRoot(RootDataSet, Relation.ChildTable.ChildRelations, DataSetName);
     }
     return null;
 }
コード例 #23
0
        internal bool UdtIsWrapped; // if UDT is wrapped , for YUKON

        /// <devdoc>
        /// <para>Initializes a new instance of the <see cref='System.Data.DataSet'/> class.</para>
        /// </devdoc>
        public DataSet() {
            GC.SuppressFinalize(this);
            Bid.Trace("<ds.DataSet.DataSet|API> %d#\n", ObjectID); // others will call this constr
            // Set default locale
            this.tableCollection = new DataTableCollection(this);
            this.relationCollection = new DataRelationCollection.DataSetRelationCollection(this);
            _culture = CultureInfo.CurrentCulture; // Set default locale
        }
コード例 #24
0
ファイル: fmExtClientWzdu.cs プロジェクト: san90279/UK_OAS
 private String GetTableNameByRelationName(InfoDataSet aDataSet, DataRelationCollection Relations, String RelationName)
 {
     String Result = "";
     if (aDataSet != null)
     {
         if (aDataSet.RealDataSet.Tables[0].TableName.CompareTo(RelationName) == 0)
             Result = RelationName;
         if (Result == "")
             Result = GetTableNameByRelationName(null, aDataSet.RealDataSet.Relations, RelationName);
     }
     else
     {
         foreach (DataRelation Relation in Relations)
         {
             if (Relation.RelationName.CompareTo(RelationName) == 0)
                 return Relation.ChildTable.TableName;
             Result = GetTableNameByRelationName(null, Relation.ChildTable.ChildRelations, RelationName);
             if (Result != "")
                 return Result;
         }
     }
     return Result;
 }
コード例 #25
0
        private void ReadElementElement(DataRow row)
        {
            // This child element (for row) might be either simple
            // content element, or child element

            // MS.NET crashes here... but it seems just a bug.
            DataColumn col = row.Table.Columns [XmlHelper.Decode(reader.LocalName)];

            if (col == null || col.Namespace != reader.NamespaceURI)
            {
                col = null;
            }

            // if col exists, then it should be MappingType.Element
            if (col != null &&
                col.ColumnMapping == MappingType.Element)
            {
                // TODO: This part is suspicious for
                // MS compatibility (test required)
                if (col.Namespace != reader.NamespaceURI)
                {
                    reader.Skip();
                    return;
                }

                bool wasEmpty = reader.IsEmptyElement;
                int  depth    = reader.Depth;
                row [col] = StringToObject(col.DataType, reader.ReadElementString());
                if (!wasEmpty && reader.Depth > depth)
                {
                    // This means, instance does not match with
                    // the schema (because the instance element
                    // contains complex content, while specified as
                    // simple), so just skip to the end of the
                    // element.
                    while (reader.Depth > depth)
                    {
                        reader.Read();
                    }
                    reader.Read();
                }
                reader.MoveToContent();
                return;
            }
            else if (col != null)
            {
                // Mismatch column type. Just skip
                reader.Skip();
                reader.MoveToContent();
                return;
            }

            // Otherwise, it might be child table element
            DataRelationCollection rels = row.Table.ChildRelations;

            for (int i = 0; i < rels.Count; i++)
            {
                DataRelation rel = rels [i];
                if (!rel.Nested)
                {
                    continue;
                }
                DataTable ct = rel.ChildTable;
                if (ct.TableName != XmlHelper.Decode(reader.LocalName) || ct.Namespace != reader.NamespaceURI)
                {
                    continue;
                }

                DataRow childRow = rel.ChildTable.NewRow();
                ReadElement(childRow);

                for (int c = 0; c < rel.ChildColumns.Length; c++)
                {
                    childRow [rel.ChildColumns [c]]
                        = row [rel.ParentColumns [c]];
                }
                rel.ChildTable.Rows.Add(childRow);
                return;
            }

            // Matched neither of the above: just skip
            reader.Skip();
            reader.MoveToContent();
        }
コード例 #26
0
        internal DataTable InstantiateTable(DataSet dataSet, XmlElement node, XmlElement typeNode)
        {
            DataTable table;
            string    name = "";
            XmlAttributeCollection attrs = node.Attributes;
            int       minOccurs          = 1;
            int       maxOccurs          = 1;
            string    str2          = null;
            ArrayList tableChildren = new ArrayList();

            if (attrs.Count > 0)
            {
                name  = this.GetInstanceName(node);
                table = dataSet.Tables.GetTable(name, this._schemaUri);
                if (table != null)
                {
                    return(table);
                }
            }
            table = new DataTable(XmlConvert.DecodeName(name))
            {
                Namespace = this._schemaUri
            };
            this.GetMinMax(node, ref minOccurs, ref maxOccurs);
            table.MinOccurs = minOccurs;
            table.MaxOccurs = maxOccurs;
            this._ds.Tables.Add(table);
            this.HandleTypeNode(typeNode, table, tableChildren);
            XMLSchema.SetProperties(table, attrs);
            if (str2 != null)
            {
                string[]     strArray    = str2.TrimEnd(null).Split(null);
                int          length      = strArray.Length;
                DataColumn[] columnArray = new DataColumn[length];
                for (int i = 0; i < length; i++)
                {
                    DataColumn column2 = table.Columns[strArray[i], this._schemaUri];
                    if (column2 == null)
                    {
                        throw ExceptionBuilder.ElementTypeNotFound(strArray[i]);
                    }
                    columnArray[i] = column2;
                }
                table.PrimaryKey = columnArray;
            }
            foreach (DataTable table2 in tableChildren)
            {
                DataRelation           relation       = null;
                DataRelationCollection childRelations = table.ChildRelations;
                for (int j = 0; j < childRelations.Count; j++)
                {
                    if (childRelations[j].Nested && (table2 == childRelations[j].ChildTable))
                    {
                        relation = childRelations[j];
                    }
                }
                if (relation == null)
                {
                    DataColumn parentKey   = table.AddUniqueKey();
                    DataColumn childColumn = table2.AddForeignKey(parentKey);
                    relation = new DataRelation(table.TableName + "_" + table2.TableName, parentKey, childColumn, true)
                    {
                        CheckMultipleNested = false,
                        Nested = true
                    };
                    table2.DataSet.Relations.Add(relation);
                    relation.CheckMultipleNested = true;
                }
            }
            return(table);
        }
コード例 #27
0
        private uint Pop(CUQueue UQueue, ref DataRelationCollection drc)
        {
            int n;
            string str;
            bool b;
            int nData;
            uint nSize = UQueue.GetSize();
            UQueue.Load(out nData);
            drc.Clear();
            for (n = 0; n < nData; n++)
            {
                DataColumn[] dcsChild = null;
                PopTableColNamesOnly(UQueue, ref dcsChild);

                UQueue.Load(out b);
                UQueue.Load(out str);

                DataColumn[] dcsParent = null;
                PopTableColNamesOnly(UQueue, ref dcsParent);

                DataRelation dr = new DataRelation(str, dcsParent, dcsChild);
                dr.Nested = b;
                drc.Add(dr);
            }
            return (nSize - UQueue.GetSize());
        }
コード例 #28
0
		// ExtendedProperties

		private bool CheckExtendedPropertyExists (
			DataTableCollection tables,
			DataRelationCollection relations)
		{
			if (ds.ExtendedProperties.Count > 0)
				return true;
			foreach (DataTable dt in tables) {
				if (dt.ExtendedProperties.Count > 0)
					return true;
				foreach (DataColumn col in dt.Columns)
					if (col.ExtendedProperties.Count > 0)
						return true;
				foreach (Constraint c in dt.Constraints)
					if (c.ExtendedProperties.Count > 0)
						return true;
			}
			if (relations == null)
				return false;
			foreach (DataRelation rel in relations)
				if (rel.ExtendedProperties.Count > 0)
					return true;
			return false;
		}
コード例 #29
0
 internal void Push(CUQueue UQueue, DataRelationCollection drc)
 {
     UQueue.Save(drc.Count);
     foreach (DataRelation dr in drc)
     {
         PushTableColNamesOnly(UQueue, dr.ChildColumns);
         UQueue.Save(dr.Nested);
         UQueue.Save(dr.RelationName);
         PushTableColNamesOnly(UQueue, dr.ParentColumns);
     }
 }