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

Possible to get the objectId of a removed "dirtyobject" ?

4 Answers 30 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.
Myth
Top achievements
Rank 1
Myth asked on 23 Mar 2010, 01:19 PM
I'm working on a new client - server project where both the client and server application use OpenAccess ORM to access their data. The client however only has read rights to the database, so when he wants to change something, he sends a change request with the required information to the server.

The server makes the changes, and alerts all clients which objects have been changed, So they can update their local objects. The way I do this is by sending the type and objectId from each object in the Scope.Transaction.DirtyObjects property.

This works great when changing or creating new objects, however when deleting an object, apart from being marked as "deleted", it seems the objectId is also removed. This way I am unable to notify my clients of which object got removed.

Any suggestions on how i could improve my program design?

 

4 Answers, 1 is accepted

Sort by
0
Myth
Top achievements
Rank 1
answered on 23 Mar 2010, 03:01 PM
I've managed to work around this by getting the ID's from deleted objects before the commit, and from the updated and new objects after the transaction.commit. Perhaps not the cleanest way, but I did make it "look clean" by using a nicely designed class.

However, my clients now get the id's of what objects are removed, but now i'm having trouble getting them to actually know which object it is that got removed. Using the scope.getObjectById method results into an error because the row with the given id does not exist.

When updating the entire list it no longer loads the removed object, but my goal is to notify users who might be making changes to the object that the object got removed and they can no longer save the changes.
0
Damyan Bogoev
Telerik team
answered on 26 Mar 2010, 12:52 PM
Hi Myth,

When an object gets deleted by OpenAccess, it is no longer associated with the Object Scope and there is no way to retrieve that object using OpenAccess API at the moment.
We have implemented functionality for detecting deleted objects in the OpenAccessDataSource by saving the ObjectId at the moment the persistent object is retrieved for updating.(for example in the View state). Then we check if an object with such id exists before committing the update. If there is no such, we know it is deleted and the update operation is canceled.

Best wishes,
Damyan Bogoev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Myth
Top achievements
Rank 1
answered on 26 Mar 2010, 02:15 PM
So its impossible to mark an object as "deleted" programatically and alert any forms currently showing the object of the matter?
0
Zoran
Telerik team
answered on 26 Mar 2010, 03:12 PM
Hi Myth,

No, it is not possible to do that at the moment. It is on our agenda for the future so I hope that we will have it implemented for the Q2 release.

Regards,
Zoran
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
General Discussions
Asked by
Myth
Top achievements
Rank 1
Answers by
Myth
Top achievements
Rank 1
Damyan Bogoev
Telerik team
Zoran
Telerik team
Share this question
or