【发布时间】:2019-03-05 06:41:12
【问题描述】:
创建我的第一个网络应用程序。使用ASP.NET 和Razor Pages+。在 VS 2017 中开发它。
(注意:类似于未回答的 S.O. 问题ASP.NET Core : Generate Razor Pages for all models)
+在 ASP.NET Core 教程 [https://docs.microsoft.com/en-us/aspnet/core/tutorials/?view=aspnetcore-2.1] 中,它说:“推荐使用 Razor Pages 使用 ASP.NET Core 2.0 创建新的 Web UI 应用程序。”
我做的第一件事是使用SSMS创建我的数据库:
然后,我创建了一个ASP.NET Core Web Application
然后,我从现有数据库创建了一个模型(仅使用了Getting Started with EF Core on ASP.NET Core with an Existing Database 的Reverse engineer your model 步骤
然后,我使用了Add a model to a Razor Pages app in ASP.NET Core 的Scaffold the movie model 步骤
脚手架步骤要求您从 Models 文件夹中选择一个类,并在(我的情况)Pages\keyw_status 文件夹中生成通用命名的 CRUD 页面。
如果我从我的模型中搭建第 2 类和第 3 类,Pages\keyw_status 文件夹中的通用名称 CRUD 页面将被覆盖。最后一个模型类脚手架获胜,对吧?
如何使用 Razor Pages 构建 3 表模型?
【问题讨论】:
标签: asp.net sql-server entity-framework-core multiple-tables razor-pages