当前位置: 首页>>代码示例>>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;未经允许,请勿转载。