New Posts New Posts RSS Feed: Emitting DML scripts ...
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Emitting DML scripts ...

 Post Reply Post Reply
Author
klmcwhirter View Drop Down
Newbie
Newbie


Joined: 29-Jan-2009
Posts: 2
Post Options Post Options   Quote klmcwhirter Quote  Post ReplyReply Direct Link To This Post Topic: Emitting DML scripts ...
    Posted: 15-Feb-2011 at 8:01am
Yeah, I saw that tutorial. Still too much work and not enough control. I do not want to probe to include it. There are other parts of the app that need to use the default IAdapterProvider.
 
So that would not work.
 
Thanks anyway.
 
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 14-Feb-2011 at 6:21pm

A custom IAdapterProvider is the supported way of doing this.   DevForce will find your implementation if it's in the probe assembles, and  based on the return value of the SupportedEntityTypes property use your provider for only the entity type(s) wanted.  DevForce will take care of adding it to the map, so yo don't need to poke it or the PersistenceServer or muck with other DevForce internals.

There's a sample IAdapterProvider in the learning unit "Insert Delete Update with Stored Procs".
Back to Top
klmcwhirter View Drop Down
Newbie
Newbie


Joined: 29-Jan-2009
Posts: 2
Post Options Post Options   Quote klmcwhirter Quote  Post ReplyReply Direct Link To This Post Posted: 14-Feb-2011 at 5:51pm
After I have manipulated the objects for a given Entity I now would like to emit DML (delete, update, insert statements) for that Entity.
 
I have looked all the way into the PersistenceServer, but am not finding the elegant hook I am looking for.
 
PersistenceServer has the AdapterProviderMap which may help if I could add my own IAdapterProvider at the right moment in time, but cannot get to the underlying instance via PersistenceServer. And even that seems like it would be more work than would be practical for one single Entity. Next thought ...
 
It seems like overriding the TransactionManagerHelper.SaveTable(...) method would head me down the path I am looking for. This would mean creating my own ITransactionManager (that would use my helper imp) which leads to creating my own PersistenceServer to use my ITransactionManager implementation. PersistenceManager has a ctor that takes a PersistenceServer. But, sheesh ...
 
 
See my point? I think I am over complicating this.
 
 
Is there a simple way to have pm.SaveChanges() emit a SQL DML script and *think* it saved successfully if the script was saved - and save nothing to the table it originally read from?
 
 
If need be I can just hard code the DML in the Entity - but thought there must be an elegant solution to allow DevForce to call the delete, update, inserts in the correct order, etc.
 
Thanks in advance.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down