Assuming I have an instance of IUnityContainer
to work with, how would I translate this StructureMap Registry
into Unity?
public class MvcRegistry : Registry
{
public MvcRegistry()
{
For<BundleCollection>().Use(BundleTable.Bundles);
For<RouteCollection>.Use(RouteTable.Routes);
}
}
so, for example...
public static class UnityContainerExtensions
{
public static IUnityContainer RegisterMvcComponents(this IUnityContainer container)
{
// similar to this:
container.RegisterType(typeof(BundleCollection), BundleTable.Bundles)
return container;
}
}
... which isn't right, but you get my meaning...
container.RegisterInstance<BundleCollection>(BundleTable.Bundles)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.