本文整理汇总了C#中Index.AddRef方法的典型用法代码示例。如果您正苦于以下问题:C# Index.AddRef方法的具体用法?C# Index.AddRef怎么用?C# Index.AddRef使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Index
的用法示例。
在下文中一共展示了Index.AddRef方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RegisterListChangedEvent
internal void RegisterListChangedEvent(Index index) {
Debug.Assert(null == _index, "DataviewListener already registered index");
_index = index;
if (null != index) {
lock (index) {
index.AddRef();
index.ListChangedAdd(this);
}
}
}
示例2: ConstraintIndexInitialize
internal void ConstraintIndexInitialize() {
//Debug.Assert(null == _constraintIndex, "non-null UniqueConstraint index");
if (null == _constraintIndex) {
_constraintIndex = key.GetSortIndex();
_constraintIndex.AddRef();
}
AssertConstraintAndKeyIndexes();
}
示例3: ConstraintIndexInitialize
internal void ConstraintIndexInitialize()
{
if (null == _constraintIndex)
{
_constraintIndex = _key.GetSortIndex();
_constraintIndex.AddRef();
}
AssertConstraintAndKeyIndexes();
}
示例4: MergeRows
internal void MergeRows(DataRow[] rows) {
DataTable src = null;
DataTable dst = null;
DataKey key = default(DataKey);
Index ndxSearch = null;
bool fEnforce = dataSet.EnforceConstraints;
dataSet.EnforceConstraints = false;
for (int i = 0; i < rows.Length; i++) {
DataRow row = rows[i];
if (row == null) {
throw ExceptionBuilder.ArgumentNull("rows[" + i + "]");
}
if (row.Table == null) {
throw ExceptionBuilder.ArgumentNull("rows[" + i + "].Table");
}
//somebody is doing an 'automerge'
if (row.Table.DataSet == dataSet)
continue;
if (src != row.Table) { // row.Table changed from prev. row.
src = row.Table;
dst = MergeSchema(row.Table);
if (dst == null) {
Debug.Assert(MissingSchemaAction.Ignore == missingSchemaAction, "MergeSchema failed");
dataSet.EnforceConstraints = fEnforce;
return;
}
if(dst.primaryKey != null) {
key = GetSrcKey(src, dst);
}
if (key.HasValue) {
// Getting our own copy instead. ndxSearch = dst.primaryKey.Key.GetSortIndex();
// IMO, Better would be to reuse index
// ndxSearch = dst.primaryKey.Key.GetSortIndex(DataViewRowState.OriginalRows | DataViewRowState.Added );
if (null != ndxSearch) {
ndxSearch.RemoveRef();
ndxSearch = null;
}
ndxSearch = new Index(dst, dst.primaryKey.Key.GetIndexDesc(), DataViewRowState.OriginalRows | DataViewRowState.Added, (IFilter)null);
ndxSearch.AddRef(); // need to addref twice, otherwise it will be collected
ndxSearch.AddRef(); // in past first adref was done in const
}
}
if (row.newRecord == -1 && row.oldRecord == -1)
continue;
DataRow targetRow = null;
if(0 < dst.Rows.Count && ndxSearch != null) {
targetRow = dst.FindMergeTarget(row, key, ndxSearch);
}
targetRow = dst.MergeRow(row, targetRow, preserveChanges, ndxSearch);
if (targetRow.Table.dependentColumns != null && targetRow.Table.dependentColumns.Count > 0)
targetRow.Table.EvaluateExpressions(targetRow, DataRowAction.Change, null);
}
if (null != ndxSearch) {
ndxSearch.RemoveRef();
ndxSearch = null;
}
dataSet.EnforceConstraints = fEnforce;
}
示例5: RegisterListChangedEvent
internal void RegisterListChangedEvent(Index index)
{
this._index = index;
if (index != null)
{
lock (index)
{
index.AddRef();
index.ListChangedAdd(this);
}
}
}