Managing a long request batch
In this recipe, we will learn the new EF 7 long request batch features.
Getting ready
We will use Visual Studio 2015 with EF 7, using the SQL Server provider.
In the previous recipe, we installed xUnit to run the unit test. In this recipe, we will create another unit test to run batches with EF.
We will see the generated SQL in the SQL profiler, a tool used to capture the database traffic on our SQL server. In this way, we will be able to watch the SQL code generated by EF.
How to do it...
- First, we will configure the
DbContextto indicate what the maximum number of requests we will allow for thisDbContextshould be, and, optionally, the timeout duration in the new unit test method we've just created:

- Next, let's add some requests to insert some items in the
Booktable:

We can see the generated SQL in the SQL Profiler now:

- Next, let's add some requests to update some items in the
Booktable

We can see the generated SQL in the SQL Profiler:

- Let's see the item in the
Book...