Linq to Entity - can i get to another table in the model when in the list template MVC page
in the out of the project template solution (Dynamic Data Web Application), I have the model created and all is good. - Get the list of the tables, and the select edit etc.
But my database has linking tables that just contain forgien keys - so the list template just displays the fk value
Is there away to combine the list of the row in the primary table with an inspection of another table based on the fk?
More akin to a join in SQL? but using Linq2Entity and the MetaModel?
Below is the List.aspx.cs - this seems to bind the standard grid to the entitydatasource, but this is to the current table as per the route in the MVC.
But as you can see i need to go and query the Person, Role and Link table via the model to get the other fields so that this would be useful.
PS want to try and keep this in LINQ2Entity if possible -trying to grok
the natural thing that I want to do is start to spin off new sql queries to go and retrive the values. But this is not in this idiom.
you can reference the metaModel via the dataContext
MetaModel refMetaModel = MetaModel.GetModel(typeof(yourdataContextName)); MetaTable refMetaModel; refMetaModel = refMetaModel.GetTable("yourTableName");
PS looked at your code and this works in your sceanrio. You can get the tables from the model then inspect the data returned for each table in the model