[Seaside] Application context
ramon.leon at allresnet.com
Mon May 18 01:44:19 UTC 2009
> "ANComponent userRepository"
> TheUserRepository ifNil: [TheUserRepository := GDRepository for:
> ^ TheUserRepository
> super initialize.
> userRepository := ANComponent userRepository.
I agree with James but I'll be more specific, how about this...
UserRepository class>>forApp: anApp
^ (Repository ifNil: [Repository := Dictionary new ])
at: anApp ifAbsentPut: [ GDRepository for: ANUser ]
userRepository := UserRespository forApp: self session baseUrl
No need to stick the repository on a component class, create a unique class
just for it, you get an automatic singleton because classes *are* singletons
and why shouldn't a user repository be its own abstraction?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the seaside