efcore
efcore copied to clipboard
Wrong model-namespace using in generated context
Hello,
if I try to scaffold an empty database to control it later by ef-versioning the generated context contains an using for the models-namespace. If the database is empty this namespace is empty as well and the compilation throws an error.
Steps to reproduce:
- create an empty database
- use "dotnet ef database scaffold" in an project
- try to compile the generated code.
Ive fixed this on my site but an general fix should prevent the first error-message which appears directly after executing the scaffold command.
Thanks, Michael
As far as I can tell, you need to meet both of the following conditions to hit this.
- Have a database with no views or tables
- Specify a
--context-namespacethat's different from the entity types'--namespace
If this isn't the case, can you share more details?
Note from triage: this very much a corner case. With the introduction of templates in EF7, this can be handled by editing the template if desired.