当前位置: 首页>>代码示例>>C#>>正文


C# Index.AddRef方法代码示例

本文整理汇总了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);
         }
     }
 }
开发者ID:uQr,项目名称:referencesource,代码行数:10,代码来源:DataViewListener.cs

示例2: ConstraintIndexInitialize

        internal void ConstraintIndexInitialize() {
            //Debug.Assert(null == _constraintIndex, "non-null UniqueConstraint index");
            if (null == _constraintIndex) {
                _constraintIndex = key.GetSortIndex();
                _constraintIndex.AddRef();
            }

            AssertConstraintAndKeyIndexes();
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:9,代码来源:UniqueConstraint.cs

示例3: ConstraintIndexInitialize

        internal void ConstraintIndexInitialize()
        {
            if (null == _constraintIndex)
            {
                _constraintIndex = _key.GetSortIndex();
                _constraintIndex.AddRef();
            }

            AssertConstraintAndKeyIndexes();
        }
开发者ID:dotnet,项目名称:corefx,代码行数:10,代码来源:UniqueConstraint.cs

示例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;
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:68,代码来源:Merger.cs

示例5: RegisterListChangedEvent

 internal void RegisterListChangedEvent(Index index)
 {
     this._index = index;
     if (index != null)
     {
         lock (index)
         {
             index.AddRef();
             index.ListChangedAdd(this);
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:12,代码来源:DataViewListener.cs


注:本文中的Index.AddRef方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。