I want to store my entity collection in viewstate and persist the changes all at once when a user clicks a save button. Has anyone done this sucessfully?
Lets say im binding a datalist to an entity collection. These are the steps i have mapped out so far:
-
Add the entity to the llblgen designer and specify any fields on relations. (so i can display foreign key values)
-
Fetch an entity collection using a prefetch path for the appropriate related fields.
-
Bind the collection to the datalist and store the entitycollection in viewstate.
-
Make changes to the entity collection based on datalist insert/edit/delete events.
-
Save the entity collection to persist the changes back to the database.
But i have some concerns, this isnt water tight quite yet. What about showing the related fields for new rows, could i refetch just the related fields, or maybee i would have to use some type of additional lookup collection? Also how could multiple new rows be refrenced in an entity collection since they would most likely not have a primary key yet.
Just wondering if anyone has accomplished something like this. Thoughts?