问题
I am using the ef core 2.0 CLI command scaffold-dbcontext to reverse engineer poco classes from an existing DB (database first). I want to put the generated classes from scaffold-dbcontext in a "Model" folder within my project but I want the namespace of the classes to be something different than "MyProjectName.Model". For example, I want the scaffold-dbcontext generated files to live in the Model folder but I want the namespace of the genereated files to be "MyProjectName.Entities".
Is there a way to control the generated namespace with the scaffold-dbcontext cli command?
(To give you a little background, I want to define the custom namespace in the generated pocos so I can have a separate set of partial classes in another folder which won't be overwritten by regenerating the model using scaffold-dbcontext).
回答1:
Currently no way to specify namespace, but similar issue open for ef 2.1 milestone.
So I hope it will be fixed in the next version.
来源:https://stackoverflow.com/questions/46555386/ef-core-2-0-scaffold-dbcontext-custom-namespace