Hi,

I would like some advice from you guys regarding contextual
dependencies

So my case looks like this, I got a bunch on components registered in
my container (transients)
In the applicaton i got something that I call realms. Each realm got
it's own database (nhibernate ISessionFactory), a mongo session
factory etc. etc.

Usually i want to resolve a component within the context of a realm,
so for example, I expect to have the correct session factory injecten
into my repositories etc.

The solution that I have today is to have one Ioc container for each
realm, and register all transients in every realms container,
additionally to register diffrent singelton instances of the
sessionfactory etc in each realm.

My prefered solution would be something like having one container to
register all my transients in (all common components, only registered
once), and depending on my context somehow provide additional
dependencies like sessionfactory etc.

Initially a childcontainer per realm (to be used as a context where I
could register sessionfactories etc) seemed like my new best friend,
but unfortunately that didn't work out:
http://issues.castleproject.org/issue/IOC-116

My next try was do provide my contextual dependencies via a
Dictionary<Type,object> at resolve time, but that didn't work either:
http://issues.castleproject.org/issue/IOC-219


My design goal is that my components should not be aware that there
exists several realms, they should just depend on the fact that all
underlying dependencies is correctly resolved.

How do you solve contextual dependencies?
Can't find any good info about someone else having the same
requirement's, have I screwed up royal in my design?


//John

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en.

Reply via email to