Last post Dec 18, 2014 01:25 PM by sjnaughton
Dec 12, 2014 01:03 PM|Laserdaniel|LINK
I am using dynamic data in VS2013 with EF6. I have installed the nuget packages Dynamic Data EF provider and the EntityDataSource control. Site works great.
Now I want to modify the templates to make the following possible:
Take an example table called MainTable, TableOne, and TableTwo. MainTable has a Primary Key and 2 columns: Scope and ScopeLookup.
If the value in MainTable.Scope is 1 then the ScopeLookup value is a value in TableOne.
If the value in MainTable.Scope is 2 then the ScopeLookup value is a value in TableTwo.
I have enumerated the Scope to an external enumeration so the Website is showing as a dropdown, but how would I tell EF to look at a different table in my model based on the value of column scope?
Or is this not really a candidate for Dynamic Data ASP.Net?
Dec 12, 2014 04:06 PM|Careed|LINK
If you're using information from the database to make this work, then you probably should do this all in the database. You might consider a view that would contain a UNION between TableOne when MainTable.Scope is 1 and TableTwo when MainTable.Scope is 2,
assuming that there is a relationship between MainTable and TableOne/TableTwo.
Dec 14, 2014 05:38 PM|sjnaughton|LINK
Hi Laserdaniel, you should be able to do this kind of thing have a look at my blog
C# Bits I have lots of article on DD and I thin you may find these are in the direction of what you need.
Dec 18, 2014 09:23 AM|Laserdaniel|LINK
Thanks for leading me in the correct direction. I found your nuget package and installed the Dynamic Data Cascade Filters and Field templates in the dynamic data website project. Installed NotAClue Dynamic Data Extensions in the project with the Entity
Data Model. In that project I have a class EntityMetaData.cs which contains all of the meta data info for my tables where I may decorate the classes with attributes like ScaffoldTable and your Cascade. Everything compiles and runs, but it doesn't seem to
be creating a dependency. I tried to change the AutoPostback = "true" on the CascadingForeignKey_Edit control, but I cant seem to get the event to fire upon creation of a new row. Any Ideas?
Dec 18, 2014 09:26 AM|Laserdaniel|LINK
Is there something I should do because I am trying to span two different projects...One for the Entity model and one for the website?
Dec 18, 2014 09:43 AM|Careed|LINK
The Dynamic Data features are for your website where your entity model would be used as your model resource.
Dec 18, 2014 09:53 AM|Laserdaniel|LINK
my entity model is not in my website. My dynamic data website works but not with the cascading fields. The application has an admin configuration that I am using the DD website for, so I wanted to re use the model for other projects as well (therefore a
Is that the problem?
Dec 18, 2014 01:25 PM|sjnaughton|LINK
is you send me a message with you e-mail I can send you a working sample.