[Seaside] Session accesible from the model of an application
Markus.Gaelli at suisa.ch
Wed Apr 18 12:34:43 UTC 2007
seaside-bounces at lists.squeakfoundation.org wrote on 18.04.2007 13:09:32:
> Göran Krampe wrote:
> > Hi!
> >> Try implementing a Registry (see "Registry Pattern") and if you are
> >> using magma in single-user mode, implement a singleton on the magma
> >> session. I opted to subclass MagmaSession and provide an #instance
> >> instance
> >> ^Session ifNil:
> >> [Session _ (MagmaSession openLocal: '/path') connectAs:
> > Ehmmm... the problem here (I presume) is that there are multiple
> > MagmaSessions being used in different Processes. So you need to get
> > of the *correct* MagmaSession - not just a singleton.
> > regards, Göran
> > _______________________________________________
> > Seaside mailing list
> > Seaside at lists.squeakfoundation.org
> > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> Hence the "if you are using single user mode" :) The singleton is merely
> for that. Use a Registry to contain the sessions, then pass that around
> your model/application.
I recently implemented a facade for this problem along the following
If there is a seaside session, fetch the DB connection from the seaside
session, otherwise fetch it from some connection holding singleton
independent of Seaside.
This way one can write stand alone tests using the same interface/facade
to the DB as the real application, as the both talk to the switching
facade. As a downside you need to run your tests then while _not_ having a
seaside session running of course.
Hope this helps,
> Pinesoft Computers are registered in England, Registered number:
> 2914825. Registered office: 266-268 High Street, Waltham Cross, Herts,
> This message has been scanned for viruses by BlackSpider MailControl
> - www.blackspider.com
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
More information about the Seaside