Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Child container disposals #335

Closed
wants to merge 1 commit into from
Closed

Child container disposals #335

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Sep 13, 2017

Potential fix for #324

@ghost
Copy link
Author

ghost commented Sep 13, 2017

Rebased with master

if (parentHandler.ComponentModel.LifestyleType == LifestyleType.Singleton || parentHandler.ComponentModel.LifestyleType == LifestyleType.Undefined)
releasePolicy = Parent.ReleasePolicy;
else
releasePolicy = this.ReleasePolicy;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will break many scenarios, if the component was registered and resolved by the parent container it might not be a transient, what about pooled, scoped or any custom lifestyle. The component should follow and be tracked by the release policy of the container it was registered in, however understand this isn't really the desired behaviour for transients.

Unfortunately the fix for this won't be so easy, as you can see child containers haven't really been designed.

Windsor however has followed the rule that if you call Resolve you must also call Release even for transients, which would fix the unit test.

@ghost
Copy link
Author

ghost commented Sep 20, 2017

Closing as per #338

@ghost ghost closed this Sep 20, 2017
@ghost ghost deleted the child-container-disposals branch June 22, 2018 00:18
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant