ef core 2.0 scaffold-dbcontext custom namespace

馋奶兔 提交于 2021-02-19 06:46:06

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!