Пример #1
0
        public void Batch_ExecuteNonQuery() {
            const int BatchSize = 30;
            const string commandText = @"DELETE FROM dbo.Region where RegionID > @RegionId";

            var commandSet = new NSoft.NFramework.Data.SqlServer.SqlCommandSet
                             {
                                 Connection = (SqlConnection)AdoTool.CreateTransactionScopeConnection(AdoRepository.Db)
                             };

            commandSet.Append((SqlCommand)AdoRepository.GetSqlStringCommand(SQL_REGION_INSERT));
            commandSet.Append((SqlCommand)AdoRepository.GetSqlStringCommand(SQL_REGION_INSERT2));

            for(int i = 0; i < BatchSize; i++) {
                var command = AdoRepository.GetSqlStringCommand(commandText, new AdoParameter("RegionId", i + 100, DbType.Int32));
                commandSet.Append((SqlCommand)command);
            }

            var executedCount = commandSet.ExecuteNonQuery();

            // 새로 추가한 위의 2개가 영향을 받습니다.
            executedCount.Should().Be(4);
        }
Пример #2
0
        public void Batch_ExecuteNonQuery()
        {
            const int    BatchSize   = 30;
            const string commandText = @"DELETE FROM dbo.Region where RegionID > @RegionId";

            var commandSet = new NSoft.NFramework.Data.SqlServer.SqlCommandSet
            {
                Connection = (SqlConnection)AdoTool.CreateTransactionScopeConnection(AdoRepository.Db)
            };

            commandSet.Append((SqlCommand)AdoRepository.GetSqlStringCommand(SQL_REGION_INSERT));
            commandSet.Append((SqlCommand)AdoRepository.GetSqlStringCommand(SQL_REGION_INSERT2));

            for (int i = 0; i < BatchSize; i++)
            {
                var command = AdoRepository.GetSqlStringCommand(commandText, new AdoParameter("RegionId", i + 100, DbType.Int32));
                commandSet.Append((SqlCommand)command);
            }

            var executedCount = commandSet.ExecuteNonQuery();

            // 새로 추가한 위의 2개가 영향을 받습니다.
            executedCount.Should().Be(4);
        }
Пример #3
0
        public void InstancingTest()
        {
            var commandSet = new NSoft.NFramework.Data.SqlServer.SqlCommandSet();

            SharpTestsEx.Extensions.Should((object)commandSet).Not.Be.Null();
        }
Пример #4
0
 public void InstancingTest() {
     var commandSet = new NSoft.NFramework.Data.SqlServer.SqlCommandSet();
     SharpTestsEx.Extensions.Should((object)commandSet).Not.Be.Null();
 }