0

As stated in this tutorial, I can scaffold code-first EF Core from an existing database using Scaffold-DbContext in the Package Manager Console.

It's all good but my problem is that it scaffolds separate class files for each table and another for the context class. I find this a bit messy if I have too many tables.

I can rearrange it all by hand but Is there a way to scaffold everything to one class file? Or maybe having the context class on a separate file and then group the tables to another file per schema.

  • It's a walk in the park to combine all the class files into one using PowerShell. You'll get duplicate `using` blocks, but these don't cause errors, and you can just remove unused `using` statements with PowerShell or something. The Power Shell command is: `Get-Content class-files.* | Set-Content combined.file`. From this SO answer: http://stackoverflow.com/a/16709708/8741 – ProfK Sep 24 '16 at 11:43

1 Answers1

0

This behavior is not an option of EF Core scaffolding as of 1.0.0.

natemcmaster
  • 25,673
  • 6
  • 78
  • 100