Databases Reference
In-Depth Information
FIGURE 1.18
Page templates in a Dynamic Data project.
Page templates rely on URL routing to determine the table they need to display and
require additional setup. Listing 1.19 shows how this is done in the Global.asax file of the
web application.
LISTING 1.19
Registering Dynamic Data URL Route in Global.asax.cs
using System;
using System.Web.DynamicData;
using System.Web.Routing;
using DataModel;
namespace WebApplication
{
public class Global : System.Web.HttpApplication
{
public static readonly MetaModel DefaultModel = new MetaModel();
void Application_Start(object sender, EventArgs e)
{
var modelConfiguration = new ContextConfiguration();
modelConfiguration.ScaffoldAllTables = true;
DefaultModel.RegisterContext(typeof(NorthwindEntities), modelConfiguration);
RouteTable.Routes.Add(new DynamicDataRoute(“{table}/{action}.aspx”));
}
}
}
 
Search WWH ::




Custom Search