I am trying to use code-first migrations, but the project that contains my CustomContext also has a derived class, TracingCustomContext which I use when tracing the SQL generated:
DbContext => CustomContext => TracingCustomContext The problem I have during code-first migrations is that when trying to run
Enable-Migrations in Package Manager Console, this results in the (not unexpected) warning:
More than one class deriving from DbContext found in the current project. Edit the generated Configuration class to specify the context to enable migrations for. In order to get past this message and move on to Add-Migration -Initial, I had to comment out my TracingCustomContext class, then run Enable-Migrations. The Configuration class that had been generated looked fine, so the suggestion in the warning didn't seem relevant.
So the question I have is whether there is any way to configure Migrations so it ignores a specific Context like TracingCustomContext? For example, an attribute to decorate the class, or a configuration setting somewhere?
Any ideas gratefully received.