Tuesday, December 03, 2013

EntityFramework 6 breaks Backup/Restore of LocalDB.

EntityFramework 6 has lots of Resiliency enhancements, but one of the side effects is that doing a backup or restore of a LocalDB database will need a tweak to keep EF from spinning up a transaction around the SQL statement.

Essentially, when you call ExecuteSqlCommand, you have to request that it does NOT ensure the a transaction exists with the first parameter of TransactionalBehavior.DoNotEnsureTransaction.

I have updated the appropriate posts:

How to backup a LocalDB database under an MVC 4 sytem
Restoring a LocalDB within an MVC web application


No comments: