New Posts New Posts RSS Feed: Sorry, recursive saves are not supported.
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Sorry, recursive saves are not supported.

 Post Reply Post Reply
Author
mikewishart View Drop Down
Groupie
Groupie
Avatar

Joined: 26-Feb-2010
Location: Reno, NV
Posts: 49
Post Options Post Options   Quote mikewishart Quote  Post ReplyReply Direct Link To This Post Topic: Sorry, recursive saves are not supported.
    Posted: 15-Feb-2011 at 9:57pm
Thanks Denis.  For now I changed it to just be straight SQL ala ADOHelper.  Later I may try and change it to be option #1 for better performance.
Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 15-Feb-2011 at 11:14am
mikewishart;

I had a discussion with a senior engineer about your use case. Here are her suggestions.

1. Consider doing the deleting of the tasks before the base.ExecuteSave, if possible, since those deletes will all then be included in the save.

2. Or consider using db triggers instead of DevForce.

3. Or consider listening for entity changes and "trigger" the deletes on the client.

Hope this helps.
Back to Top
mikewishart View Drop Down
Groupie
Groupie
Avatar

Joined: 26-Feb-2010
Location: Reno, NV
Posts: 49
Post Options Post Options   Quote mikewishart Quote  Post ReplyReply Direct Link To This Post Posted: 14-Feb-2011 at 2:01pm
We have a table of tasks associated with objects in a certain state.  If, for whatever reason, the objects change state the tasks are no longer valid.  This is more of a proactive thing where the tasks should be deleted within the same transaction as changing the object's state, but rather than tracking down every related bug, we can write a general purpose query to do this and not worry about it.
Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 14-Feb-2011 at 1:55pm
Hi mikewishart;

Could you elaborate further on your use case here? I'm still unclear why you want to perform a delete operation inside the save interceptor. If you want to perform a delete after a save, why can't you do it outside the interceptor, for example, after the mgr.SaveChanges call?
Back to Top
mikewishart View Drop Down
Groupie
Groupie
Avatar

Joined: 26-Feb-2010
Location: Reno, NV
Posts: 49
Post Options Post Options   Quote mikewishart Quote  Post ReplyReply Direct Link To This Post Posted: 11-Feb-2011 at 7:18pm
Just had to post that very nice polite error message!

In the EntityServerSaveInterceptor, I want to clean up potential orphans by deleting the records AFTER the base.ExecuteSave() has been called.  After all, they may have already cleaned up the orphaned records, or perhaps they modified associated entities in such a way that they aren't orphans.

      var orphans = EntityManager.GetQuery<OrphanTable>()
        .With(QueryStrategy.DataSourceOnly)
        .Where(somePredicate)
        .ToList();

      foreach (var orphan in orphans)
        orphan.EntityAspect.Delete();

      EntityManager.SaveChanges(orphans);

The last line is where I get the error.  Any chance of getting it to save further updates?

Thanks!

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down