开发者

Scaffolding problem in my MVC asp.net dynamic data web app

I am working on an asp.net MVC application. I have the following code in my global.asax file for dynamic data implementation

Code snippet 1:

model.RegisterContext(typeof(MyCustomEntities), new ContextConfiguration() { ScaffoldAllTables = false });

Code snippet 2:

routes.Add(new DynamicDataRoute("{table}/{action}.aspx")
{
    Constraints = new RouteValueDictionary(
     new { action = "List|Details|Edit|Insert" }),
    Model = model
});

Code snippet 3:

//routes.Add("MyTable1", new DynamicDataRoute("MyTable1/{action}.aspx")
//{
//    Constraints = new RouteValueDictionary(new { action = "List|Details|Edit|Insert" }),
//    Model = model,
//    Table = "MyTable1"
//});

Code snippet 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
);

Problem is despite of having scaffoldingAlltables = false, I get the listing of all tables in my Default.aspx page.

I have aroung 50 tables but i want dynamic data for only 3 or 4 tables. The problem gets solved if I comment code snippet 4, but I cannot do that. Is there a workaround for this?

开发者_Python百科I also tried commenting code snippet 2 and adding code snippet 3 for all the tables I want to list. Still it shows all the 50 tables.

Regards,

HARI

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜