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

Add check scope extra data #63

Closed
ipjohnson opened this issue Feb 12, 2017 · 1 comment
Closed

Add check scope extra data #63

ipjohnson opened this issue Feb 12, 2017 · 1 comment

Comments

@ipjohnson
Copy link
Owner

Currently when a type can not be located the IInjectionContext will be checked to see if it can be resolved. Expanding this to IExportLocatorScope allows the lifetime scope to be used in even more complex scenarios.

I see the use case as providing simple keyed values (string, int, etc)

@ipjohnson
Copy link
Owner Author

        [Fact]
        public void LifetimeScope_Backup_Resolution_Source_With_Name()
        {
            var container = new DependencyInjectionContainer();

            using (var scope = container.BeginLifetimeScope(extraData: new { value = 5 }))
            {
                var instance = scope.Locate<DependentService<int>>();

                Assert.NotNull(instance);
                Assert.Equal(5, instance.Value);
            }
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant