41 lines
1.4 KiB
C#
41 lines
1.4 KiB
C#
using Autofac;
|
|
using Prism.Ioc;
|
|
|
|
namespace Prism.Autofac
|
|
{
|
|
/// <summary>
|
|
/// Extensions help get the underlying <see cref="IUnityContainer" />
|
|
/// </summary>
|
|
public static class PrismIocExtensions
|
|
{
|
|
/// <summary>
|
|
/// Gets the <see cref="IUnityContainer" /> from the <see cref="IContainerProvider" />
|
|
/// </summary>
|
|
/// <param name="containerProvider">The current <see cref="IContainerProvider" /></param>
|
|
/// <returns>The underlying <see cref="IUnityContainer" /></returns>
|
|
public static IContainer GetContainer(this IContainerProvider containerProvider)
|
|
{
|
|
return ((IContainerExtension<IContainer>)containerProvider).Instance;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets the <see cref="IUnityContainer" /> from the <see cref="IContainerProvider" />
|
|
/// </summary>
|
|
/// <param name="containerRegistry">The current <see cref="IContainerRegistry" /></param>
|
|
/// <returns>The underlying <see cref="IUnityContainer" /></returns>
|
|
public static IContainer GetContainer(this IContainerRegistry containerRegistry)
|
|
{
|
|
return ((IContainerExtension<IContainer>)containerRegistry).Instance;
|
|
}
|
|
/// <summary>
|
|
/// Gets the <see cref="ContainerBuilder"/> used to register services.
|
|
/// </summary>
|
|
/// <param name="registry"></param>
|
|
/// <returns>The current <see cref="ContainerBuilder"/></returns>
|
|
public static ContainerBuilder GetBuilder(this IContainerRegistry registry)
|
|
{
|
|
return ((IAutofacContainerExtension)registry).Builder;
|
|
}
|
|
}
|
|
}
|