问题
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