Skip to content
This repository has been archived by the owner on Apr 26, 2020. It is now read-only.

Consider separating registration semantics from resolution #60

Closed
tillig opened this issue Oct 25, 2016 · 2 comments
Closed

Consider separating registration semantics from resolution #60

tillig opened this issue Oct 25, 2016 · 2 comments

Comments

@tillig
Copy link

tillig commented Oct 25, 2016

I'm working through some issues like this one and this one in Autofac trying to figure out where container.Update gets used and why.

Something I noticed is that in NancyBootstrapperWithRequestContainerBase and, subsequently, the Autofac implementation of it that the application container (an ILifetimeScope in this case) gets updated with registrations rather than having them present during initial container build in the first place. This can cause challenges with some things like AutoActivate and IStartable components. Using Update is generally also a red flag to me because it means if something has already been resolved out of the container (unlikely, but possible) then it could be inconsistent with the same service type that gets resolved post Update.

Have you considered separating resolution of bootstrapper components (the Get methods on the bootstrapper class) from the registration of components (the Register tasks)?

I do recognize you may be pretty far down the path to make such a change, but I figured I'd ask.

@khellang
Copy link
Member

The short answer is; yes 😉

We realize that this is suboptimal, but there's not much we can do about it using the existing design. We've prototyped a new version of the Nancy bootstrapper that allows this. You can check it out here

@tillig
Copy link
Author

tillig commented Oct 25, 2016

Oh, yup, that looks way better. Cool beans, that prototype looks nice. Thanks for the pointer!

@tillig tillig closed this as completed Oct 25, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants