Asp.net mvc 我的MVC asp.net动态数据web应用中的脚手架问题
我正在开发一个asp.net MVC应用程序。我的global.asax文件中有以下代码用于动态数据实现 代码片段1:Asp.net mvc 我的MVC asp.net动态数据web应用中的脚手架问题,asp.net-mvc,dynamic-data,scaffolding,Asp.net Mvc,Dynamic Data,Scaffolding,我正在开发一个asp.net MVC应用程序。我的global.asax文件中有以下代码用于动态数据实现 代码片段1: model.RegisterContext(typeof(MyCustomEntities), new ContextConfiguration() { ScaffoldAllTables = false }); 代码段2: routes.Add(new DynamicDataRoute("{table}/{action}.aspx") { Constraints =
model.RegisterContext(typeof(MyCustomEntities), new ContextConfiguration() { ScaffoldAllTables = false });
代码段2:
routes.Add(new DynamicDataRoute("{table}/{action}.aspx")
{
Constraints = new RouteValueDictionary(
new { action = "List|Details|Edit|Insert" }),
Model = model
});
代码片段3:
//routes.Add("MyTable1", new DynamicDataRoute("MyTable1/{action}.aspx")
//{
// Constraints = new RouteValueDictionary(new { action = "List|Details|Edit|Insert" }),
// Model = model,
// Table = "MyTable1"
//});
代码片段4:
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute("{resource}.aspx/{*pathInfo}");
routes.MapRoute(
"Default",
// Route name
"{controller}/{action}/{id}",
// URL with parameters
new { controller = "Home", action = "Index", id = "" }
// Parameter defaults
);
问题是,尽管scaffoldingAlltables=false,我还是在Default.aspx页面中得到了所有表的列表
我有大约50个表,但我只需要3或4个表的动态数据。如果我对代码片段4进行注释,问题就会得到解决,但我不能这样做。有解决办法吗
我还尝试对代码段2进行注释,并为我要列出的所有表添加代码段3。它仍然显示了所有的50张桌子
问候,
哈里