New Posts New Posts RSS Feed: View-backed Business Objects
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

View-backed Business Objects

 Post Reply Post Reply
Author
evanian View Drop Down
Newbie
Newbie


Joined: 23-Apr-2010
Posts: 7
Post Options Post Options   Quote evanian Quote  Post ReplyReply Direct Link To This Post Topic: View-backed Business Objects
    Posted: 20-May-2010 at 9:59am
I have had reason to create a business entity class backed by a view that cannot be updated, and  I would like to allow entities of this class to be editable in my application.  However, I want to prevent these view-backed entities being saved to the database, since to attempt this will cause a database error.

Is there any way to mark an entity class or a set of objects as being not-for-saving so that the Persistence Manager knows not to attempt to save them to the database?  Thanks in advance for any help anyone might have!


Edited by evanian - 20-May-2010 at 10:00am
Back to Top
IdeaBlade View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 30-May-2007
Location: United States
Posts: 353
Post Options Post Options   Quote IdeaBlade Quote  Post ReplyReply Direct Link To This Post Posted: 21-May-2010 at 5:06pm

The PersistenceManager has a (client-side) Saving event that you can handle to inspect (and change) the collection of Entities being submitted for a save.  The handler gets an EntitySavingEventArgs parameter that has an Entities property which is an IList<Entity> and contains all the Entities being submitted. Simply remove the entities you don't want submitted from that list.

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down