EF Core OnConfiguring method
Posted: Fri 06 Apr 2018 12:23
The generator always adds the following lines to the OnConfiguring method:
(Our problem with this, we cannot initialize the database with InMemory mode, because it checks for connection string or connection and if not present add SqlServer as provider.).
This behavior is not good for us. I can't adjust the options to skip this step.
Is there any ways to achieve this?
Code: Select all
if (!optionsBuilder.Options.Extensions.OfType<RelationalOptionsExtension>().Any(ext => !string.IsNullOrEmpty(ext.ConnectionString) || ext.Connection != null))
optionsBuilder.UseSqlServer(@"Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=xxx;Integrated Security=True;Persist Security Info=True");
This behavior is not good for us. I can't adjust the options to skip this step.
Is there any ways to achieve this?