Skip to content

Add check scope extra data #63

Closed
Closed

Description

@ipjohnson

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)

Activity

  1. ipjohnson commented on Feb 12, 2017

    @ipjohnson
    OwnerAuthor
            [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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions