當前位置: 首頁>>代碼示例>>C#>>正文


C# DataColumn.SetOrdinalInternal方法代碼示例

本文整理匯總了C#中System.Data.DataColumn.SetOrdinalInternal方法的典型用法代碼示例。如果您正苦於以下問題:C# DataColumn.SetOrdinalInternal方法的具體用法?C# DataColumn.SetOrdinalInternal怎麽用?C# DataColumn.SetOrdinalInternal使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Data.DataColumn的用法示例。


在下文中一共展示了DataColumn.SetOrdinalInternal方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: AddUniqueKey

        internal DataColumn AddUniqueKey(int position) {
            if (_colUnique != null)
                return _colUnique;

            // check to see if we can use already existant PrimaryKey
            DataColumn[] pkey = PrimaryKey;
            if (pkey.Length == 1)
                // We have one-column primary key, so we can use it in our heirarchical relation
                return pkey[0];

            // add Unique, but not primaryKey to the table

            string keyName = XMLSchema.GenUniqueColumnName(TableName + "_Id", this);
            DataColumn key = new DataColumn(keyName, typeof(Int32), null, MappingType.Hidden);
            key.Prefix = tablePrefix;
            key.AutoIncrement = true;
            key.AllowDBNull = false;
            key.Unique = true;

            if (position == -1)
                Columns.Add(key);
            else { // we do have a problem and Imy idea is it is bug. Ask Enzo while Code review. Why we do not set ordinal when we call AddAt?
                for(int i = Columns.Count -1; i >= position; i--) {
                    this.Columns[i].SetOrdinalInternal(i+1);
                }
                Columns.AddAt(position, key);
                key.SetOrdinalInternal(position);
            }

            if (pkey.Length == 0)
                PrimaryKey = new DataColumn[] {
                    key
                };

            _colUnique = key;
            return _colUnique;
        }
開發者ID:nlh774,項目名稱:DotNetReferenceSource,代碼行數:37,代碼來源:DataTable.cs

示例2: ArrayAdd

 private void ArrayAdd(DataColumn column)
 {
     this._list.Add(column);
     column.SetOrdinalInternal(this._list.Count - 1);
     this.CheckIChangeTracking(column);
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:6,代碼來源:DataColumnCollection.cs

示例3: ArrayRemove

 private void ArrayRemove(DataColumn column)
 {
     column.SetOrdinalInternal(-1);
     this._list.Remove(column);
     int count = this._list.Count;
     for (int i = 0; i < count; i++)
     {
         ((DataColumn) this._list[i]).SetOrdinalInternal(i);
     }
     if (column.ImplementsIChangeTracking)
     {
         this.RemoveColumnsImplementingIChangeTrackingList(column);
     }
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:14,代碼來源:DataColumnCollection.cs

示例4: AddUniqueKey

 internal DataColumn AddUniqueKey(int position)
 {
     if (this._colUnique == null)
     {
         DataColumn[] primaryKey = this.PrimaryKey;
         if (primaryKey.Length == 1)
         {
             return primaryKey[0];
         }
         DataColumn column = new DataColumn(XMLSchema.GenUniqueColumnName(this.TableName + "_Id", this), typeof(int), null, MappingType.Hidden) {
             Prefix = this.tablePrefix,
             AutoIncrement = true,
             AllowDBNull = false,
             Unique = true
         };
         if (position == -1)
         {
             this.Columns.Add(column);
         }
         else
         {
             for (int i = this.Columns.Count - 1; i >= position; i--)
             {
                 this.Columns[i].SetOrdinalInternal(i + 1);
             }
             this.Columns.AddAt(position, column);
             column.SetOrdinalInternal(position);
         }
         if (primaryKey.Length == 0)
         {
             this.PrimaryKey = new DataColumn[] { column };
         }
         this._colUnique = column;
     }
     return this._colUnique;
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:36,代碼來源:DataTable.cs


注:本文中的System.Data.DataColumn.SetOrdinalInternal方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。