Skip to content

UnityContainerExtensions.Resolve(this IUnityContainer container, Type t, string name, params ResolverOverride[] overrides) seems to be missing #304

@JesperRisager

Description

@JesperRisager

I am upgrading from Unity v3.5.1404 to Unity v5.11.9 and I ran into the following problem:

string key = "NamedRegistration"
Container.Resolve(serviceType, key);

will not compile.

In v3.5.1404 there is the following method:

///


/// Get an instance of the requested type with the given name from the container.
///

/// of object to get from the container.
/// Name of the object to retrieve.
/// Any overrides for the resolve call.
/// The retrieved object.
public object Resolve(Type t, string name, params ResolverOverride[] resolverOverrides) => this.DoBuildUp(t, name, (IEnumerable) resolverOverrides);

In v5.11.9 I can only find a generic version, but I don't know the type before runtime, so that is not optimal to use for me.

The documentation at http://unitycontainer.org/tutorials/resolution/type.html states the following:

Resolve(Type t, string name) | Returns an instance of the type registered with the container as the type t and with the specified name. Names are case sensitive.

What am I missing here?

If it is simply because the method is missing in UnityContainerExtensions, it is super easy to add, since the generic methods just calls a non generic implementation anyways.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions