Skip to content

Export by key and generic #145

Closed
Closed

Description

@xp-development

Cannot locate object by key and generic.

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

	container.Configure(c =>
	{
		c.Export(typeof(ImportGenericService<>)).AsKeyed(typeof(IImportGenericService<>), "A");
		c.Export<BasicService>().As<IBasicService>();
	});

	var service = container.Locate<IImportGenericService<IBasicService>>(withKey: "A");

	Assert.NotNull(service);
	Assert.NotNull(service.Value);
	Assert.IsType<BasicService>(service.Value);
}

Activity

  1. ipjohnson commented on Jan 9, 2018

    @ipjohnson
    Owner

    Sorry about that, I've committed a fix to the dev branch for this and will look to do a release in the coming days.

  2. ipjohnson commented on Jan 14, 2018

    @ipjohnson
    Owner

    This is released in 6.3.1

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions