Hi :)
I have this compositional problem in that I have a mvc web application
that acts as a host for mini-applications that in concert compose a
modular application.
The host has several system-wide services that handles stuff like
persistence, logging, users, permissions and so on. These need to have
different lifetimes (singleton, pr httprequest, session) and use named
services in order to support multi-tenancy w.r.t. different
implementations of specific components.
Apparently this is relatively easy to get up and going with Autofac
when looking into the system.web integration support Autofac has mvc
and
asp.net (not so sure about session scoping) - However, when
considering that mini-applications should not mess about with
registrations of components in the application container, nor
registrations of each other leads to thinking about one application
container and multiple mini-app containers.
The deal is that these mini-app containers should have scoping of
components that correspond to httprequest, session and singleton, yet
be able to resolve "system-wide" services via their parent container.
This means that components in the mini-app can take constructor
dependency on components from the host ifself and the mini-app
subsystem itself.
I don't think configuring a child container on each request seems like
is a viable solution, so my thinking is that when bootstrapping I do
something similar like:
First the bootstrap application container, then for each mini-app
create a child container and pass it to the mini-app to configure and
store it in the application container, identified by a guid that I can
deduce on each http request. Then when a http request comes along I
get a hold on the application container and create a request container
from it, then in the request container's scope where the execution
pipeline for the mini-app begins I resolve the child container by guid
and again create a request lifetime scope from there, and when the
execution pipeline ends, i dispose that request lifetime scope.
I am not confident that this the correct approach. The only container
that seems be able to do this is Castle Windsor with its ability to
register child containers directly on parent containers - Structuremap
does not handle this as it just has a simple nested container
functionality that does not work with this.
I have looked through almost every post here related to the matter,
surfed the net, looked at Orchard code. Nothing I found takes an
approach that I wish for.
How are people doing this host container -> child containers with
regards to resolving upwards + having same lifetime scope features on
both levels?
Cheers,
Hopefully an Autofac user soon :)
--
You received this message because you are subscribed to the Google Groups "Autofac" group.
To post to this group, send email to
aut...@googlegroups.com.
To unsubscribe from this group, send email to
autofac+u...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/autofac?hl=en.