no-build prevents the scaffolding process from being performed?

非 Y 不嫁゛ 提交于 2020-03-05 04:11:10

问题


My textbook says:

dotnet ef dbcontext scaffold "Server (localdb)\MSSQLLocalDB;Database=XXX" "Microsoft.EntityFrameworkCore.SqlServer" --output-dir "Models/Scaffold" --context ScaffoldContext --force --no-build

--no-build argument prevents the project from being built before the scaffolding process is performed. It is easy to get into a situation where the scaffolding process generates a data model that is out of sync with the rest of the application, such as controllers and views. Entity Framework Core tries to build the project by default before scaffolding a database, and a failed build—commonly because a property or data model class has been removed—will prevent the scaffolding process from being performed

I kind of get the idea, but I'm still confused by the description. If the project tries to build the project by default before scaffolding a database, there is no modifications in data model since the scaffolding hasn't started yet, and if there is a failed build, that means there are existing errors in the application and we have to rectify them, then do the scaffolding. The 'out of sync' situation only exists after the scaffolding process is finished, but even a failed build happens, the scaffolding process has been finished anyway, we just need to simply rebuild the project. So how can the scaffolding process get prevented from being performed?

To summary, the textbook says "a failed build—commonly because a property or data model class has been removed" (my note here: this can only happen after scaffolding process finished and therefore some properties were removed from data model)

which contradicted by

"(a failed build because of properties removal) will prevent the scaffolding process from being performed"

so how can sth to be prevented from happening if it has happened already?

来源:https://stackoverflow.com/questions/57526519/no-build-prevents-the-scaffolding-process-from-being-performed

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