示例#1
0
        /// <include file='doc\DataTableCollection.uex' path='docs/doc[@for="DataTableCollection.RegisterName"]/*' />
        /// <devdoc>
        /// Registers this name as being used in the collection.  Will throw an ArgumentException
        /// if the name is already being used.  Called by Add, All property, and Table.TableName property.
        /// if the name is equivalent to the next default name to hand out, we increment our defaultNameIndex.
        /// </devdoc>
        internal void RegisterName(string name)
        {
            Debug.Assert(name != null);

            CultureInfo locale     = dataSet.Locale;
            int         tableCount = List.Count;

            for (int i = 0; i < tableCount; i++)
            {
                if (NamesEqual(name, ((DataTable)List[i]).TableName, true, locale) != 0)
                {
                    throw ExceptionBuilder.DuplicateTableName(((DataTable)List[i]).TableName);
                }
            }
            if (NamesEqual(name, MakeName(defaultNameIndex), true, locale) != 0)
            {
                defaultNameIndex++;
            }
        }
示例#2
0
        internal void RegisterName(string name, string tbNamespace)
        {
            Bid.Trace("<ds.DataTableCollection.RegisterName|INFO> %d#, name='%ls', tbNamespace='%ls'\n", this.ObjectID, name, tbNamespace);
            CultureInfo locale = this.dataSet.Locale;
            int         count  = this._list.Count;

            for (int i = 0; i < count; i++)
            {
                DataTable table = (DataTable)this._list[i];
                if ((base.NamesEqual(name, table.TableName, true, locale) != 0) && (tbNamespace == table.Namespace))
                {
                    throw ExceptionBuilder.DuplicateTableName(((DataTable)this._list[i]).TableName);
                }
            }
            if (base.NamesEqual(name, this.MakeName(this.defaultNameIndex), true, locale) != 0)
            {
                this.defaultNameIndex++;
            }
        }
示例#3
0
        /// <summary>
        /// Registers this name as being used in the collection.  Will throw an ArgumentException
        /// if the name is already being used.  Called by Add, All property, and Table.TableName property.
        /// if the name is equivalent to the next default name to hand out, we increment our defaultNameIndex.
        /// </summary>
        internal void RegisterName(string name, string tbNamespace)
        {
            DataCommonEventSource.Log.Trace("<ds.DataTableCollection.RegisterName|INFO> {0}, name='{1}', tbNamespace='{2}'", ObjectID, name, tbNamespace);
            Debug.Assert(name != null);

            CultureInfo locale     = _dataSet.Locale;
            int         tableCount = _list.Count;

            for (int i = 0; i < tableCount; i++)
            {
                DataTable table = (DataTable)_list[i];
                if (NamesEqual(name, table.TableName, true, locale) != 0 && (tbNamespace == table.Namespace))
                {
                    throw ExceptionBuilder.DuplicateTableName(((DataTable)_list[i]).TableName);
                }
            }
            if (NamesEqual(name, MakeName(_defaultNameIndex), true, locale) != 0)
            {
                _defaultNameIndex++;
            }
        }