Unity 等同于 StructureMap 的 For<T>().Use(SomeThing)

What's the Unity equivalent of StructureMap's For<T>().Use(SomeThing)

假设我有一个 IUnityContainer 的实例可以使用,我如何将这个 StructureMap Registry 转换成 Unity?

public class MvcRegistry : Registry
{
    public MvcRegistry()
    {
        For<BundleCollection>().Use(BundleTable.Bundles);
        For<RouteCollection>.Use(RouteTable.Routes);
    }
}

所以,例如...

public static class UnityContainerExtensions
{
    public static IUnityContainer RegisterMvcComponents(this IUnityContainer container)
    {
        // similar to this:
        container.RegisterType(typeof(BundleCollection), BundleTable.Bundles)
        return container;
    }
}

...这不对,但你明白我的意思...

RegisterInstance方法:

container.RegisterInstance<BundleCollection>(BundleTable.Bundles)