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

Unity Container - Resolves Single Element #125

Closed
dansiegel opened this issue Jun 29, 2020 · 1 comment
Closed

Unity Container - Resolves Single Element #125

dansiegel opened this issue Jun 29, 2020 · 1 comment

Comments

@dansiegel
Copy link
Owner

Description

Similar to issue #124 Unity has issues with multiple registrations followed by a ResolveAll.

Expected

container.RegisterType<IFoo, FooA>();
container.RegisterType<IFoo, FooB>();

// Return an instance of FooB
var fooB = container.Resolve<IFoo>();

// Return an IEnumerable with 2 elements FooA and FooB
var all = container.Resolve<IEnumerable<IFoo>>();
var allAlt = container.ResolveAll<IFoo>();

Actual

// This works as expected
var fooB = container.Resolve<IFoo>();

// This only returns a collection with the single element for FooB
var all = container.Resolve<IEnumerable<IFoo>>();

// This returns an empty collection
var allAlt = container.ResolveAll<IFoo>();
@dansiegel
Copy link
Owner Author

fixed by #126

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

No branches or pull requests

1 participant