namespace Dawn.HIS.MVC.CommonSupport
{
public class UnityControllerFactory : DefaultControllerFactory
{
private readonly IUnityContainer container;
public UnityControllerFactory(IUnityContainer container)
{
//要做异常处理
this.container = container;
}
protected override IController GetControllerInstance(Type controllerType)
{ //这里把Controller实例注册到了unity容器
IController icontroller = container.Resolve(controllerType) as IController;
return icontroller;
}
}
}