New Posts New Posts RSS Feed: A 'not-so-basic' PersistenceService example.
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

A 'not-so-basic' PersistenceService example.

 Post Reply Post Reply
Author
philcockfield View Drop Down
Newbie
Newbie
Avatar

Joined: 03-Jun-2009
Posts: 19
Post Options Post Options   Quote philcockfield Quote  Post ReplyReply Direct Link To This Post Topic: A 'not-so-basic' PersistenceService example.
    Posted: 09-Jun-2009 at 7:58pm
>> ... as long as you are prepared to regard it as a point of departure for your own work.

Thanks Ward...I'll do just that.  A good point of departure is just what I'm looking for.

>> Finally, a word about the "one async operation at a time" .... We didn't want to burden this sample code with them. We can start a new thread to discuss such feature if you like.

Great - I'll get back to you on this once (or if) I encounter the need.  Your comment suggests it might just not be a realistic concern.

Thanks again.
--
Phil
Back to Top
WardBell View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 31-Mar-2009
Location: Emeryville, CA,
Posts: 338
Post Options Post Options   Quote WardBell Quote  Post ReplyReply Direct Link To This Post Posted: 09-Jun-2009 at 11:22am
Yes, we do have tutorials and some code samples for more robust saving and exception handling.
 
We were trying not overwhelm the example with all of the stuff you can do in a real application, including:
  • Check for "nothing to save"
  • Validate all entities that are about to be saved (client-side, server-side, or both)
  • Process and respond to the several types of exceptions that might be reported (lost connection, concurrency violation, unexpected database integrity or schema complaints (oops!), ...)
  • Raise EventAggregator event identifying saved/deleted entities that other modules might care about

In industrial code, I end up with quite a few PersistenceService helper classes to carry this load. It's a bit much to stuff into a Model Explorer / Prism Explorer and, frankly, we were concerned that, if we included it in our sample, people would conclude that DevForce itself is too complicated.

It is not DevForce that is complicated. It is the requirement that is complicated.
 
If you look around ... check out any magazine article or any vendor's code samples ... you will observe that these concerns are never addressed. They are alluded to but no one wants to reveal these aspects of the sausage factory.
 
On the other hand, I don't want you to have to re-invent the machinery that we've already got stashed in the back room.
 
I'm not prepared to do a big scrub and public presentation of this topic just yet. Do ping our support team if you want a copy of the code "as is". The machinery isn't beautiful and well documented ... but it exists ... and we'll share it with you ... as long as you are prepared to regard it as a point of departure for your own work.
 
Finally, a word about the "one async operation at a time" comment. Most applications don't need to stack up a bunch of queries that are processed collectively. DevForce has some pretty cool support for this kind of thing - both parallel and serial async operations (with inter-operation dependencies and exception handling). We didn't want to burden this sample code with them. We can start a new thread to discuss such feature if you like.
Back to Top
philcockfield View Drop Down
Newbie
Newbie
Avatar

Joined: 03-Jun-2009
Posts: 19
Post Options Post Options   Quote philcockfield Quote  Post ReplyReply Direct Link To This Post Posted: 07-Jun-2009 at 10:14am
In the ModelExplorer (and PrismExplorer) examples there is a Persistence service implmenetation called 'BasicPersistenceService' which has the following remarks:

    /// <summary>A basic implementation of IPersistenceService.</summary>
    /// <remarks>
    /// Will only perform one async operation at a time.
    /// Limited exception handling
    /// No save smarts.
    /// </remarks>

Do you have reference examples of more sophisticated persistence-service implementations with 'save smarts' and 'multi async operation' abilities? Or maybe just comments on what kinds of save smarts would be sensible to consider...etc etc./

Just checking...while I'm in learning mode I'm being careful not to rush out and re-invent the wheel wherever possible.

Thanks!

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down