Пример #1
0
        public async Task ExecuteSelectThousandsOfParametersWithHeader()
        {
            var Configuration = new ConfigurationBuilder()
                                .AddInMemoryCollection()
                                .Build();
            var Instance = new SQLHelper(Canister.Builder.Bootstrapper.Resolve <ObjectPool <StringBuilder> >(), Configuration, null)
                           .CreateBatch(SqlClientFactory.Instance, "Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false");

            Instance.AddHeader(CommandType.Text, "DECLARE @A as nvarchar(100);");
            Instance.AddHeader(CommandType.Text, "SET @A ='BLAH';");
            for (var x = 0; x < 4000; ++x)
            {
                Instance.AddQuery(CommandType.Text, "SELECT * FROM [TestDatabase].[dbo].[TestTable] WHERE [TestDatabase].[dbo].[TestTable].[ID]=@0 AND @A='BLAH'", x);
            }
            var ListResult = await Instance.ExecuteAsync().ConfigureAwait(false);

            Assert.Equal(4000, ListResult.Count);
        }