ASP.NET Core : Generate Razor Pages for all models

百般思念 提交于 2019-12-10 15:00:06

问题


I have created a ASP.NET Core 2.1 project With "Database first" approach and Razor Pages (no MVC). All my models are generated from the database context.

I successfully created CRUD Razor Pages for one of my models with a command line like this one :

dotnet aspnet-codegenerator razorpage -m Student -dc RazorDemoContext -udl -outDir Pages\Students

I have approximatively 50+ models. Is there a command line to generate CRUD Razor Pages for all models at the same time and not just one by one ?

Thank you


回答1:


I suggest you produce the whole list of script by using a SELECT statement against your database :

select 'dotnet aspnet-codegenerator razorpage -m '+  name +' -dc RazorDemoContext -udl -outDir Pages\'+name+'s' 
    from sysobjects 
    where type = 'U'


来源:https://stackoverflow.com/questions/50894240/asp-net-core-generate-razor-pages-for-all-models

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