I have update my EF to EF 6.0.2 in my code I have the following line of code:
applicationDbContext.Database .ExecuteSqlCommand(@"ALTER DATABASE
CURRENT SET RECOVERY FULL;");
After updating I get the following error message:
ALTER DATABASE statement not allowed within multi-statement transaction.
I have fixed the problem with a TransctionalBehavior like the the code below:
applicationDbContext.Database.ExecuteSqlCommand(
TransactionalBehavior.DoNotEnsureTransaction, @"ALTER DATABASE CURRENT SET RECOVERY FULL;");
My question:
- Why I'm getting this error with EF 6?
- My fix is a valid fix for the problem or a devil hiding behind this solution?
- Is there any other approach to solve the problem?
Any help will be greatly appreciated!?