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

Added support for configure action #506

Merged
merged 1 commit into from
Sep 12, 2019
Merged

Conversation

seesharper
Copy link
Owner

This PR adds support for configuring the ContainerOptions using a delegate.

var container = new ServiceContainer(o => o.EnablePropertyInjection = false);

Requested by @haavamoa 😎

@seesharper seesharper merged commit f369e27 into master Sep 12, 2019
@seesharper seesharper deleted the feature/configure-action branch September 12, 2019 13:32
@haavamoa
Copy link
Contributor

Great @seesharper! Love this way of condiguring. ❤️
If I am not reading this wrong, wouldnt this change involve a breaking change? You might want to concider supporting both scenarios instead of breaking it.

@seesharper
Copy link
Owner Author

👍 I don't think we broke anything. Old constructors are still there. Or did I miss something? 😊

/// <param name="options">The <see cref="ContainerOptions"/> instances that represents the configurable options.</param>
public ServiceContainer(ContainerOptions options)
/// <param name="configureOptions">A delegate used to configure <see cref="ContainerOptions"/>.</param>
public ServiceContainer(Action<ContainerOptions> configureOptions)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this adding or changing @seesharper? I am on my phone, so might miss something in this small view.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Ah, I see how that might look like a breaking change. The constructor code was moved from ServiceContainer(ContainerOptions options) to ServiceContainer(Action<ContainerOptions> configureOptions)

The constructor with no parameters should create a ContainerOptions instance with the default values. It does so by calling into ServiceContainer(Action<ContainerOptions> configureOptions) with an "empty" configureOptionsdelegate so that the ContainerOptions instance created within ServiceContainer(Action<ContainerOptions> configureOptions) is left unchanged (default)"

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.

2 participants