3

私はasp.netMVCアプリケーションに取り組んでいます。動的データ実装用のglobal.asaxファイルに次のコードがあります

コードスニペット1:

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個のテーブルすべてが表示されます。

よろしく、

ハリ

4

0 に答える 0