Skip to content

AutofacDependencyResolver.UnregisterCurrent(Type?) method

Defined in

Type: AutofacDependencyResolver Namespace: Splat.Autofac Assembly: Splat.Autofac.dll

Applies to

net11.0, net10.0, netstandard2.0, net47, net472, net471, net48, net481

Overloads

  1. public virtual void UnregisterCurrent(Type? serviceType)

  2. public virtual void UnregisterCurrent(Type? serviceType, string? contract)

  3. public void UnregisterCurrent<T>()

  4. public void UnregisterCurrent<T>(string? contract)

1. Overload

Deprecated

Because Autofac 5+ containers are immutable, UnregisterCurrent method is not available anymore. Instead, simply register your service after InitializeReactiveUI to override it https://autofaccn.readthedocs.io/en/latest/register/registration.html#default-registrations (opens in a new tab).

Attributes: [Obsolete("Because Autofac 5+ containers are immutable, UnregisterCurrent method is not available anymore. Instead, simply register your service after InitializeReactiveUI to override it https://autofaccn.readthedocs.io/en/latest/register/registration.html#default-registrations.")]

public virtual void UnregisterCurrent(Type? serviceType)

View source (opens in a new tab)

Inherited documentation

These docs were inherited from IMutableDependencyResolver. The member doesn't override them on this type.

Summary: Because Autofac 5+ containers are immutable (opens in a new tab), UnregisterCurrent method is not available anymore. Instead, simply register your service after InitializeReactiveUI (opens in a new tab) to override it.

Parameters

NameTypeDescription
serviceTypeType? (opens in a new tab)The service type to unregister.

Remarks

If no instance of the specified service type is registered, this method has no effect.

Exceptions

TypeCondition
System.NotSupportedException (opens in a new tab)This is not implemented by default.

2. Overload

Deprecated

Because Autofac 5+ containers are immutable, UnregisterCurrent method is not available anymore. Instead, simply register your service after InitializeReactiveUI to override it https://autofaccn.readthedocs.io/en/latest/register/registration.html#default-registrations (opens in a new tab).

Attributes: [Obsolete("Because Autofac 5+ containers are immutable, UnregisterCurrent method is not available anymore. Instead, simply register your service after InitializeReactiveUI to override it https://autofaccn.readthedocs.io/en/latest/register/registration.html#default-registrations.")]

public virtual void UnregisterCurrent(Type? serviceType, string? contract)

View source (opens in a new tab)

Inherited documentation

These docs were inherited from IMutableDependencyResolver. The member doesn't override them on this type.

Summary: Because Autofac 5+ containers are immutable (opens in a new tab), UnregisterCurrent method is not available anymore. Instead, simply register your service after InitializeReactiveUI (opens in a new tab) to override it.

Parameters

NameTypeDescription
serviceTypeType? (opens in a new tab)The service type to unregister.
contractstring? (opens in a new tab)The optional contract value, which will only remove the value associated with the contract.

Exceptions

TypeCondition
System.NotSupportedException (opens in a new tab)This is not implemented by default.

3. Overload

Deprecated

Because Autofac 5+ containers are immutable, UnregisterCurrent method is not available anymore. Instead, simply register your service after InitializeReactiveUI to override it https://autofaccn.readthedocs.io/en/latest/register/registration.html#default-registrations (opens in a new tab).

Attributes: [Obsolete("Because Autofac 5+ containers are immutable, UnregisterCurrent method is not available anymore. Instead, simply register your service after InitializeReactiveUI to override it https://autofaccn.readthedocs.io/en/latest/register/registration.html#default-registrations.")]

public void UnregisterCurrent<T>()

View source (opens in a new tab)

Inherited documentation

These docs were inherited from IMutableDependencyResolver. The member doesn't override them on this type.

Summary: Unregisters the current instance of the specified type from the context.

Type parameters

NameDescription
TThe type of the instance to unregister from the current context.

4. Overload

Deprecated

Because Autofac 5+ containers are immutable, UnregisterCurrent method is not available anymore. Instead, simply register your service after InitializeReactiveUI to override it https://autofaccn.readthedocs.io/en/latest/register/registration.html#default-registrations (opens in a new tab).

Attributes: [Obsolete("Because Autofac 5+ containers are immutable, UnregisterCurrent method is not available anymore. Instead, simply register your service after InitializeReactiveUI to override it https://autofaccn.readthedocs.io/en/latest/register/registration.html#default-registrations.")]

public void UnregisterCurrent<T>(string? contract)

View source (opens in a new tab)

Inherited documentation

These docs were inherited from IMutableDependencyResolver. The member doesn't override them on this type.

Summary: Unregisters the current instance of type T associated with the specified contract, if any.

Type parameters

NameDescription
TThe type of the instance to unregister.

Parameters

NameTypeDescription
contractstring? (opens in a new tab)An optional contract name that specifies which registration to remove. If null, the default registration for type T is unregistered.

Remarks

If no instance of type T is registered with the specified contract, this method has no effect.