Recommendation please - dynamically loaded "apps" that register their own services

22 views
Skip to first unread message

davi...@live.com

unread,
Jan 3, 2017, 5:18:51 PM1/3/17
to Autofac
I would appreciate a recommendation on what approach best fits with AutoFac.

I'm building a platform (user ASP.NET) that supports pluggable "apps." I'm using AutoFac extensively for global and per-request scoped services. Now I need to allow my plugged in apps to register components/services but I'm not sure how to do that. Here's the challenge:

One of the current services is the singleton AppManager service which is responsible for loading each app and getting it started up. The challenge is this: the AppManager of course has various dependencies that it needs injected in so the app manager can't be instantiated in order to load apps until Build() has already been run on the IContainer. Only then can each app be given a chance to register its services.   But by then the container has been built.

I've seen that there is an Update() method for the container but there are strong reasons listed why using that should be avoided.  Because I have confidence that the app-based registration will happen early in the startup of the whole platform maybe these cautions can be ignored (?), but I'm wondering if there is some better way.

How would you approach this in a way most consistent with best practices for AutoFac?

David

davi...@live.com

unread,
Jan 3, 2017, 5:21:49 PM1/3/17
to Autofac, davi...@live.com
I will also cross-post on Stack Overflow.

Travis Illig

unread,
Jan 3, 2017, 5:23:46 PM1/3/17
to Autofac, davi...@live.com
This is a great question that would go well on the discussion issue where we're trying to centrally gather data about why people believe they need to update an existing container.

I'll add a response over there. It'd be good to have further discussion there so we can capture in a single place all the use cases and make sure we're doing the right thing.

David Ornstein

unread,
Jan 3, 2017, 5:32:03 PM1/3/17
to Travis Illig, Autofac

I’ll put the question there and you can respond then.


Thanks.

David Ornstein

unread,
Jan 3, 2017, 5:42:35 PM1/3/17
to aut...@googlegroups.com, Travis Illig

Done

--
You received this message because you are subscribed to a topic in the Google Groups "Autofac" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/autofac/1C9T_r4kX7c/unsubscribe.
To unsubscribe from this group and all its topics, send an email to autofac+u...@googlegroups.com.
To post to this group, send email to aut...@googlegroups.com.
Visit this group at https://groups.google.com/group/autofac.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages