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

Thread is closed for posting
5 posts, 0 answers
  1. Myth
    Myth avatar
    54 posts
    Member since:
    Jan 2010

    Posted 23 Mar 2010 Link to this post

    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?

     

  2. Myth
    Myth avatar
    54 posts
    Member since:
    Jan 2010

    Posted 23 Mar 2010 Link to this post

    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.
  3. Damyan Bogoev
    Admin
    Damyan Bogoev avatar
    581 posts

    Posted 26 Mar 2010 Link to this post

    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.
  4. Myth
    Myth avatar
    54 posts
    Member since:
    Jan 2010

    Posted 26 Mar 2010 Link to this post

    So its impossible to mark an object as "deleted" programatically and alert any forms currently showing the object of the matter?
  5. Zoran
    Admin
    Zoran avatar
    534 posts

    Posted 26 Mar 2010 Link to this post

    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.
Back to Top