本文整理汇总了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;
}
示例2: ArrayAdd
private void ArrayAdd(DataColumn column)
{
this._list.Add(column);
column.SetOrdinalInternal(this._list.Count - 1);
this.CheckIChangeTracking(column);
}
示例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);
}
}
示例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;
}