How is persisted the dependency?

Chris Muller chris at funkyobjects.org
Sun Feb 11 20:29:56 UTC 2007


The default behavior of Magma is to persist the directly connected
graph.  With the standard dependency mechanism, dependents are not
directly connected, so they will not be persisted.

You may also be interested in using Magma's own events to set up your
listeners, something like:

  mySession serializer preferences
    afterMaterializingAny: #MyModel
    do:
      [ : aMyModel |
      aMyModel
        when: #magmaRefreshed
        send: #changed
        to: aMyModel ]

This way, an abort anywhere which causes any MyModel to be refreshed
with different data will know to send changed to itself so that views
will be updated.

For this to work you also have to implement MyModel>>#wantsMagmaEvents
to return true.

To see an example of this and more, check out
MagmaSession>>#initializeSerializer.

At the opposite side, any directly-connected variable can be declared
transient by simply implementing #maTransientVariables..  nil will be
stored in the repository in its place..

 - Chris

--- Hilaire Fernandes <hilaire2006 at laposte.net> wrote:

> When persisting an object, what is the situation regarding
> persistency
> of the Dependent object.
> 
>   For example, with one model and view object, the view is registered
> as
> a dependent of the model, of course we want to persist the model but
> not
> the view.
> What is happening when persisting the model?
> It seems to the view will be persisted as well although it is not
> desirable. Is it correct?
> 
> Hilaire
> 
> _______________________________________________
> Magma mailing list
> Magma at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/magma
> 



More information about the Magma mailing list