Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to suppress ambient transaction warning with EF7 RC2

How to suppress ambient transaction warning with EF7 RC2?

The SuppressAmbientTransactionWarning() method cannot be found.

like image 894
Steven Muhr Avatar asked Dec 08 '25 07:12

Steven Muhr


1 Answers

While the question was related to RC2, as of Oct 16, 2016, this worked for me and hopefully it is useful to someone else:

services.AddDbContext<OpenDataContext>(options =>
   {
       options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"));
       options.ConfigureWarnings(x => x.Ignore(RelationalEventId.AmbientTransactionWarning));
   });

Used above in an integration test setup class.

like image 192
Dave Avatar answered Dec 10 '25 23:12

Dave



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!