ResetIndexes() 개인적인 메소드

private ResetIndexes ( ) : void
리턴 void
예제 #1
0
        /// <summary>
        /// Clears the collection of all rows.
        /// </summary>
        public void Clear()
        {
            if (this.table.DataSet != null && this.table.DataSet.EnforceConstraints)
            {
                foreach (Constraint c in table.Constraints)
                {
                    UniqueConstraint uc = c as UniqueConstraint;
                    if (uc == null)
                    {
                        continue;
                    }
                    if (uc.ChildConstraint == null || uc.ChildConstraint.Table.Rows.Count == 0)
                    {
                        continue;
                    }

                    string err = String.Format("Cannot clear table Parent because " +
                                               "ForeignKeyConstraint {0} enforces Child.", uc.ConstraintName);
                    throw new InvalidConstraintException(err);
                }
            }

            table.DataTableClearing();
            List.Clear();

            // Remove from indexes
            table.ResetIndexes();
            table.DataTableCleared();
            OnListChanged(this, new ListChangedEventArgs(ListChangedType.Reset, -1, -1));
        }
예제 #2
0
        private void MergeTable(DataTable src, DataTable dst)
        {
            int  rowsCount = src.Rows.Count;
            bool wasEmpty  = dst.Rows.Count == 0;

            if (0 < rowsCount)
            {
                Index     ndxSearch   = null;
                DataKey   key         = null;
                ArrayList saveIndexes = dst.LiveIndexes;
                dst.indexes = new ArrayList();
                if (!wasEmpty && dst.primaryKey != null)
                {
                    key = GetSrcKey(src, dst);
                    if (key != null)
                    {
                        ndxSearch = dst.primaryKey.Key.GetSortIndex(DataViewRowState.OriginalRows | DataViewRowState.Added);
                    }
                }
                for (int i = 0; i < rowsCount; i++)
                {
                    DataRow sourceRow = src.Rows[i];
                    DataRow targetRow = null;
                    if (ndxSearch != null)
                    {
                        targetRow = dst.FindMergeTarget(sourceRow, key, ndxSearch);
                    }
                    dst.MergeRow(sourceRow, targetRow, preserveChanges, ndxSearch);
                }
                dst.indexes = saveIndexes;
                dst.ResetIndexes();
            }
            MergeExtendedProperties(src.ExtendedProperties, dst.ExtendedProperties);
        }
예제 #3
0
        /// <include file='doc\DataTableCollection.uex' path='docs/doc[@for="DataTableCollection.Add"]/*' />
        /// <devdoc>
        ///    <para>
        ///       Adds
        ///       the specified table to the collection.
        ///    </para>
        /// </devdoc>
        public virtual void Add(DataTable table)
        {
            OnCollectionChanging(new CollectionChangeEventArgs(CollectionChangeAction.Add, table));
            BaseAdd(table);
            ArrayAdd(table);

            // need to reset indices if CaseSensitve is ambient
            if (table.caseSensitiveAmbient)
            {
                table.ResetIndexes();
            }
            OnCollectionChanged(new CollectionChangeEventArgs(CollectionChangeAction.Add, table));
        }
 public void Add(DataTable table)
 {
     IntPtr ptr;
     Bid.ScopeEnter(out ptr, "<ds.DataTableCollection.Add|API> %d#, table=%d\n", this.ObjectID, (table != null) ? table.ObjectID : 0);
     try
     {
         this.OnCollectionChanging(new CollectionChangeEventArgs(CollectionChangeAction.Add, table));
         this.BaseAdd(table);
         this.ArrayAdd(table);
         if (table.SetLocaleValue(this.dataSet.Locale, false, false) || table.SetCaseSensitiveValue(this.dataSet.CaseSensitive, false, false))
         {
             table.ResetIndexes();
         }
         this.OnCollectionChanged(new CollectionChangeEventArgs(CollectionChangeAction.Add, table));
     }
     finally
     {
         Bid.ScopeLeave(ref ptr);
     }
 }
        /// <devdoc>
        ///    <para>
        ///       Adds
        ///       the specified table to the collection.
        ///    </para>
        /// </devdoc>
        public void Add(DataTable table)
        {
            IntPtr hscp;

            Bid.ScopeEnter(out hscp, "<ds.DataTableCollection.Add|API> %d#, table=%d\n", ObjectID, (table != null) ?  table.ObjectID : 0);
            try {
                OnCollectionChanging(new CollectionChangeEventArgs(CollectionChangeAction.Add, table));
                BaseAdd(table);
                ArrayAdd(table);

                if (table.SetLocaleValue(dataSet.Locale, false, false) ||
                    table.SetCaseSensitiveValue(dataSet.CaseSensitive, false, false))
                {
                    table.ResetIndexes();
                }
                OnCollectionChanged(new CollectionChangeEventArgs(CollectionChangeAction.Add, table));
            }
            finally {
                Bid.ScopeLeave(ref hscp);
            }
        }
예제 #6
0
        /// <summary>
        /// Adds the specified table to the collection.
        /// </summary>
        public void Add(DataTable table)
        {
            long logScopeId = DataCommonEventSource.Log.EnterScope("<ds.DataTableCollection.Add|API> {0}, table={1}", ObjectID, (table != null) ? table.ObjectID : 0);

            try
            {
                OnCollectionChanging(new CollectionChangeEventArgs(CollectionChangeAction.Add, table));
                BaseAdd(table);
                ArrayAdd(table);

                if (table.SetLocaleValue(_dataSet.Locale, false, false) ||
                    table.SetCaseSensitiveValue(_dataSet.CaseSensitive, false, false))
                {
                    table.ResetIndexes();
                }
                OnCollectionChanged(new CollectionChangeEventArgs(CollectionChangeAction.Add, table));
            }
            finally
            {
                DataCommonEventSource.Log.ExitScope(logScopeId);
            }
        }
예제 #7
0
        /// <summary>
        /// Adds the specified table to the collection.
        /// </summary>
        public void Add(DataTable table)
        {
            long logScopeId = DataCommonEventSource.Log.EnterScope("<ds.DataTableCollection.Add|API> {0}, table={1}", ObjectID, (table != null) ? table.ObjectID : 0);
            try
            {
                OnCollectionChanging(new CollectionChangeEventArgs(CollectionChangeAction.Add, table));
                BaseAdd(table);
                ArrayAdd(table);

                if (table.SetLocaleValue(_dataSet.Locale, false, false) ||
                    table.SetCaseSensitiveValue(_dataSet.CaseSensitive, false, false))
                {
                    table.ResetIndexes();
                }
                OnCollectionChanged(new CollectionChangeEventArgs(CollectionChangeAction.Add, table));
            }
            finally
            {
                DataCommonEventSource.Log.ExitScope(logScopeId);
            }
        }