This is a migrated thread and some comments may be shown as answers.

ASP.NET: saving changed data on postback

3 Answers 138 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Mikael Kleinwort
Top achievements
Rank 1
Mikael Kleinwort asked on 07 Nov 2008, 09:47 PM
I am unclear what is the best way to deal with this pretty common scenario using Telerik OpenAccess ORM:

I have a simple webform (ASP.NET 3.5) used for editing records of data. On postback, the changed records need to be written back to the database.

Where I am unclear is how do I accomplish the data update with concurrency check. When I do not use OpenAccess ORM but ASP.NET's LinqToSQL functionality, I use a DataConext to fetch the data from the database and fill the webform controls, and on postback, I read the same DataContext from the database, and I use the Attach() method to attach the changed objects from the webform to the DataContext. I can tell ASP.NET which fields to use to check for concurrency check (i.e. a last-changed-date field, or a combination of fields). The DataContext then knows whether an object is dirty, and it also knows which data needs to be written back to the database.

I am entirely unclear about how to do this basic task with OpenAccess ORM, specifically the part where I attach a postback object to the ObjectScope. The only solution I have seen so far from the documentation is using an ObjectContainer, but this would mean that I need to store the entire ObjectContainer either in the webform or in SessionState on the server betwee postbacks.I can't imagine that this is the easiest way to proceed in ths basic scenario.

I wouldd very much appreciate any input on this.

3 Answers, 1 is accepted

Sort by
0
Jan Blessenohl
Telerik team
answered on 10 Nov 2008, 09:02 AM
Hi Mikael Kleinwort,

I hope this is answered by the other reply.

All the best,
Jan Blessenohl
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Ken Grant
Top achievements
Rank 1
answered on 08 Jan 2009, 06:40 PM
I thought this was a good question. But I can't see where it's been replied to. Any chance of of link.
0
Jan Blessenohl
Telerik team
answered on 09 Jan 2009, 03:43 PM
Hi Ken Grant,
You have to use the OpenAccessDataSource to get this functionality. At the moment we are enhancing our DataSource so that you really can hook into all operations done by the web controls.

You have to use the automatic DataSource functionality at the moment.

All the best,
Jan Blessenohl
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
General Discussions
Asked by
Mikael Kleinwort
Top achievements
Rank 1
Answers by
Jan Blessenohl
Telerik team
Ken Grant
Top achievements
Rank 1
Share this question
or