Пример #1
0
        public void Add(ShardedTableInfo shardedTableInfo)
        {
            ExceptionUtils.DisallowNullArgument <ShardedTableInfo>(shardedTableInfo, "shardedTableInfo");

            string existingTableType;

            lock (_syncObject)
            {
                if (CheckIfTableExists(shardedTableInfo, out existingTableType))
                {
                    throw new SchemaInfoException(
                              SchemaInfoErrorCode.TableInfoAlreadyPresent,
                              Errors._SchemaInfo_TableInfoAlreadyExists,
                              existingTableType,
                              shardedTableInfo.SchemaName,
                              shardedTableInfo.TableName);
                }

                bool result = _shardedTables.Add(shardedTableInfo);
                // Adding to the sharded table set shouldn't fail since we have done all necessary
                // verification apriori.
                Debug.Assert(result, "Addition of new sharded table info failed.");
            }
        }
Пример #2
0
 /// <summary>
 /// Removes information about a sharded table.
 /// </summary>
 /// <param name="shardedTableInfo">Sharded table info.</param>
 public bool Remove(ShardedTableInfo shardedTableInfo)
 {
     return(_shardedTables.Remove(shardedTableInfo));
 }