Building issue in my asp.net MVC web application for dynamic data

I am working on an ASP.NET asp.net application. I have the following code in my global.asax file for dynamically implementing data

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

The problem, despite the fact that scaffoldingAlltables = false, I get a list of all the tables in my Default.aspx page.

I have 50 tables, but I need dynamic data for only 3 or 4 tables. The problem will be solved if I comment on the code snippet 4, but I can not do this. Is there a workaround for this?

I also tried to comment out the code for fragment 2 and added code snippet 3 for all the tables I want to list. However, it shows all 50 tables.

Hi,

HARI

+3

Source: https://habr.com/ru/post/1772825/


All Articles