Forum:  LLBLGen Pro Runtime Framework

Thread:  UnitOfWork saved entities


TomV (User)   Posted on: 16-Jun-2008 12:33:36.
Hi,

I'm using an UnitOfWork to save my entities. Everything works just fine Laugh
But when the save (process of unit of work) is done, I would like to get all adapted entities. I want to know which entities were inserted/updated/deleted to or from the persistent storage. I need these to send to our server (Genuine Channels) so this server can inform all clients that an entity has been changed and that they should update the object (and corresponding forms/screens) if they use the adapted entity.

I've been playing around with the UnitOfWork, but after the save I'm unable to access the deleted entities. Can you please help me out on this one and give me the best way to handle my problem.

The only alternative is that I use the GetCollectionElementsToDelete before I process the unit of work. But maybe there's a more elegant way to handle this 'problem'

The nicest solution for me would be an collection with all adapted entities, like uow.GetAllAdaptedEntities(), but I guess this is wishfull thinking Wink

Kind regards
TomV
goose (User)   Posted on: 16-Jun-2008 19:14:51.
I beleive there is not a nicest solution available at the moment.

Otis (LLBLGen Pro Team)   Posted on: 17-Jun-2008 14:18:12.
Call: ConstructSaveProcessQueues()
this creates the save queues. You can then obtain the save queues (insert/update) by using:
GetInsertQueue and GetUpdateQueue.

To obtain the entities to delete, use GetCollectionElementsToDelete and GetEntityElementsToDelete
TomV (User)   Posted on: 18-Jun-2008 19:18:29.
Hi Otis,

Thanks for your reply. I'll give it a try.

Kind regards
TomV


TomV (User)   Posted on: 24-Jun-2008 15:19:47.
Hi,

It works. I first call the ConstructSaveProcessQueues() method. Before I process my unit of work I loop over GetCollectionElementsToDelete and GetEntityElementsToDelete collection. After the save, I loop the Insert and Update queue. By this I have all saved entities and can pass them all to our synchronisation server (Genuine Channels).

Problem solved!

Kind regards,
TomV