著者が次のようにカスタムコントローラーファクトリーを作成しようとしている本の例を見ています。(CreateController メソッドのみ参照)
public IController CreateController(RequestContext requestContext,
string controllerName) {
Type targetType = null;
switch (controllerName) {
case "Product":
targetType = typeof(ProductController);
break;
case "Customer":
targetType = typeof(CustomerController);
break;
default:
requestContext.RouteData.Values["controller"] = "Product";
targetType = typeof(ProductController);
break;
}
return targetType == null ? null :
(IController)DependencyResolver.Current.GetService(targetType);
}
デフォルトの場合、controllerName のデフォルトのケースの値は、既存のコントローラー (製品) に設定されています。これにより、MVC フレームワークが、ユーザーが要求したコントローラーではなく、フォールバック コントローラーに関連付けられたビューを検索するようになるためです。私の質問は、Product と Customer のケースで同様の方法でビューが検索されないのはなぜですか?