Dynamic Data woes


Pete Hurst


I've been trying to set up my new blog/portfolio site using Dynamic Data. I
haven't got very far.

I *have* managed to get as far as scaffolding all my tables and creating
metadata attributes. Very nice. But this is where all the examples and
tutorials seem to stop.

What I now need to do is heavily customise both the UI and business logic.

What I'm really looking for would be an example *full working website*
created using DD. The downloadable examples I've found are all of the
"simple 2 table website" variety which don't really give me any clues as to
how I can hook in any advanced customisation.

For instance, how can I complete the following workflow:

- A user creates a new record in a scaffolded insert form
- As this record is being saved, I want to create a related record in
another table, if certain conditions are met on the insert record
- If this related record IS created, then I want to also modify some
properties on the record being inserted, including the FK that actually
links the insert record to the new one

The only way I can see to do this in LinqToSQL is by overriding the
SubmitChanges method of DataContext, looking for particular entity types
being inserted, and perform my business logic there. But I really don't see
how that's the best place to do it.

I've also been trying with Dynamic Data Entities. Here it seems I have to
attach to the SavingChanges event of the ObjectContext, but the process here
for determining what type of objects are being updated seems even more
bizarre and arcane.

Am I missing something or is this really the only way of doing things?

Why do the entities not have partial methods like OnInserting and
OnUpdating? (Perhaps with access to the attached Context in case I want to
insert any other records during the save...)

And are there any more complete examples for me to look at?

Thanks in advance,
Pete Hurst


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question