locked
DynamicDataRoute problem RRS feed

  • Question

  • User188291263 posted

    I want certain tables in a menu(default.aspx) to point to my custom aspx,for example SingleEntity.aspx

    I tried doing this:

                var singleEntityTables = model.Tables.Where(t => t.Attributes.OfType<SingleEntityAttribute>().Any());


                routes.Add(new DynamicDataRoute("{table}/{action}.aspx")
                {
                    Constraints = new RouteValueDictionary(new { action = "SingleEntity", table = String.Join("|", singleEntityTables.Select(t => t.Name).ToArray()) }),
                    Model = model
                });

                routes.Add(new DynamicDataRoute("{table}/{action}.aspx")
                {
                    Constraints = new RouteValueDictionary(new { action = "List|Details|Edit|Insert", table = String.Join("|", model.Tables.Except(singleEntityTables).Select(t => t.Name).ToArray()) }),
                    Model = model
                });

    My table in singleEntityTables not show up in menu. If i change SingleEntity on List it works. Question is, is MetaModel.Default.VisibleTables only return tables which support action List????

    If yes,how i can implement my logic.

    Thank you

     

    Tuesday, August 26, 2008 9:51 PM

Answers

  • User188291263 posted

     Ok found solution:
              

                var singleEntityTables = model.Tables.Where(t => t.Attributes.OfType<SingleEntityAttribute>().Any());

                routes.Add(new DynamicDataRoute("{table}/{action}.aspx")
                {
                    Constraints = new RouteValueDictionary(new { action = "List|Details|Edit|Insert", table = String.Join("|", model.Tables.Except(singleEntityTables).Select(t => t.Name).ToArray()) }),
                    Model = model

                });

                routes.Add(new DynamicDataRoute("{table}/Single.aspx")
                {
                    Action = PageAction.List,
                    Table = String.Join("|", singleEntityTables.Select(t => t.Name).ToArray()),
                    ViewName = "Single",
                    Model = model,
                   
                });

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, August 27, 2008 5:11 PM
  • User-797310475 posted

    Question is, is MetaModel.Default.VisibleTables only return tables which support action List???? 

    Yes, VisibleTables only returns tables for which there is a URL to the List action.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, August 27, 2008 6:49 PM

All replies

  • User188291263 posted

     Ok found solution:
              

                var singleEntityTables = model.Tables.Where(t => t.Attributes.OfType<SingleEntityAttribute>().Any());

                routes.Add(new DynamicDataRoute("{table}/{action}.aspx")
                {
                    Constraints = new RouteValueDictionary(new { action = "List|Details|Edit|Insert", table = String.Join("|", model.Tables.Except(singleEntityTables).Select(t => t.Name).ToArray()) }),
                    Model = model

                });

                routes.Add(new DynamicDataRoute("{table}/Single.aspx")
                {
                    Action = PageAction.List,
                    Table = String.Join("|", singleEntityTables.Select(t => t.Name).ToArray()),
                    ViewName = "Single",
                    Model = model,
                   
                });

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, August 27, 2008 5:11 PM
  • User-797310475 posted

    Question is, is MetaModel.Default.VisibleTables only return tables which support action List???? 

    Yes, VisibleTables only returns tables for which there is a URL to the List action.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, August 27, 2008 6:49 PM