代码之家  ›  专栏  ›  技术社区  ›  VA systems engineer

如何使用Razor页面在ASP.NET web应用程序中为3表数据库建模[[副本]

  •  1
  • VA systems engineer  · 技术社区  · 6 年前

    正在创建我的第一个web应用。使用 ASP.NET Razor Pages + . 2017年开发。

    (注:与未回答的S.O.问题类似 ASP.NET Core : Generate Razor Pages for all models )

    https://docs.microsoft.com/en-us/aspnet/core/tutorials/?view=aspnetcore-2.1]

    我做的第一件事就是用 SSMS

    enter image description here

    然后,我创建了一个 ASP.NET Core Web Application

    enter image description here

    Reverse engineer your model 第步 Getting Started with EF Core on ASP.NET Core with an Existing Database

    enter image description here

    然后,我用 Scaffold the movie model 第步 Add a model to a Razor Pages app in ASP.NET Core

    enter image description here

    脚手架步骤要求您从Models文件夹中选择一个类,并在pages\keyw\u status文件夹(我的例子)中生成通用命名的CRUD页。

    如果我从我的模型中构建第2和第3个类,pages\keyw\u status文件夹中的一般命名的CRUD页将被覆盖。最后一个模特班的脚手架赢了,对吧?

    如何使用 剃须刀页面

    1 回复  |  直到 6 年前
        1
  •  1
  •   Mike Brind    6 年前

    可以使用 -outDir

    下面的命令将为 DateTable 页面\数据表 .

    dotnet aspnet-codegenerator razorpage -m DateTable -dc keyw_statusContext -udl -outDir Pages\DateTable
    
    推荐文章