I'm currently working on a project that involves Dynamic Data (DD) and the Entity Framework (EF).
My model has a many-to-many relationship, which EF handles pretty well. The junction table doesn't show up in the conceptual model.
Unfortunately, the current version of DD is not able to cope with these scenario's. Luckily, DD guru David Ebbo has created a template for this.
I'll share some details of how I got this working in my project.
- Copy the templates (I had to manually copy the code into newly addes template files. Simply changing the namespace wasn't sufficient; but that's probably an issue on my machine)
- Add the routes for ListDetails to global asax. (I had to add the DD prefix, and had to place this entry before the existing DD routes) ....
routes.Add(new DynamicDataRoute("DD/{table}/ListDetails.aspx")
{
Action = PageAction.List,
ViewName = "ListDetails",
Model = model
});
- Add the AutoFieldGenerator class (in the project where your model is located)
- Modify the implementation of ListDetails
ps: the column order in your table is relevant! My guess is that the template shows the first non-PK column.