First Entity Framework Code Database Recovery Model

Can I set the recovery model model of an SQL database created using Entity Framework 6? I know that you can install it through the following SQL statement:

ALTER DATABASE [Database_Name] SET RECOVERY SIMPLE; 

It seems strange that this cannot be set as part of the DbContext configuration - the object that creates the database does not seem to be able to control how it is created. I expected to find something like the following:

 public class MyContext : DbContext { public MyContext(string connectionString) : base(connectionString) { // This is where I would have expected to be able to set the recovery model type Database.RecoveryModel = RecoveryModelType.Simple; } } 

My suspicion is that this is not possible because the EF (largely) DB provider agnostic and recovery model are MSSQL specific, but I hope I am wrong.

+5
source share

Source: https://habr.com/ru/post/1269434/


All Articles