예제 #1
0
        private static void CopyShoppingCartItemsToTempTable(string shardingKey, string uniqueProcessString,
                                                             ReliableSqlConnection sourceSqlConnection, BulkCopier copier)
        {
            // Copy shopping cart items from source to destination
            var shoppingCartItemReaderCommand =
                new SqlCommand("[Shardlets].[GetShoppingCartItemsByCustomerId]", sourceSqlConnection.Current)
            {
                CommandType = CommandType.StoredProcedure
            };

            shoppingCartItemReaderCommand.Parameters.Add(CreateShardingKeyParameter(shardingKey));
            var shoppingCartItemReader = shoppingCartItemReaderCommand.ExecuteReader();

            var shoppingCartItemTableName = GetTempTableName(uniqueProcessString, "[Shardlets].[ShoppingCartItem_");

            copier.Copy(shoppingCartItemReader, shoppingCartItemTableName);

            shoppingCartItemReader.Close();
        }
예제 #2
0
        private static void CopySalesOrderHeadersIntoTempTable(string shardingKey, string uniqueProcessString,
                                                               ReliableSqlConnection sourceSqlConnection, BulkCopier copier)
        {
            // Copy sales order header from source to destination
            var headerReaderCommand =
                new SqlCommand("[Shardlets].[GetSalesOrderHeadersByCustomerId]", sourceSqlConnection.Current)
            {
                CommandType = CommandType.StoredProcedure
            };

            headerReaderCommand.Parameters.Add(CreateShardingKeyParameter(shardingKey));
            var headerReader = headerReaderCommand.ExecuteReader();

            var headerTargetTableName = GetTempTableName(uniqueProcessString, "[Shardlets].[SalesOrderHeader_");

            copier.Copy(headerReader, headerTargetTableName);

            headerReader.Close();
        }