read-only BOs in case of un-persistence objects

read-only BOs in case of un-persistence objects

Old forum URL: forums.lhotka.net/forums/t/4049.aspx


shaih posted on Sunday, December 16, 2007

Hi,

I am looking for the correct way of doing the following:

I would like to have a few BOs that are loaded from the database and from that point have a life of their own (not persistent against the database) - the idea behind this is to have a template in the database and create objects from the template, the objects will not need to save any information to the database but they can change (add items to the item lists, change member data etc).

I still want to support the data portal methods like delete, update and so on but this will be local and not update the database.

Should I use read-only BOs or editable BOs that implement the data portal methods to run locally?

Should I create these methods under the business methods and keep it apart from the data portal methods?

 

Thanks 

JoeFallon1 replied on Sunday, December 16, 2007

Sounds like you should use an Editable object but then only code for DataPortal_Fetch.

This makes it act more like a ReadOnly object. Except you can change the values.

You could write methods like Update or Save but they would *NOT* be DataPortal methods since you do not want to hit the DB. They would just do whatever you thought they should do locally to the object.

Joe

 

ajj3085 replied on Monday, December 17, 2007

Just create your BO like normal.  In your dataportal create (or fetch) you can load from any datasource you like.  Your update or insert can then talk to a different database (or table) if you want.  If you're doing something like templates, it sounds like you'd be creating new objects based off a template.  In that case, your New factory method can take a template id or something like that, and your DP_C can load from the database.

Copyright (c) Marimer LLC