Trong ứng dụng của tôi, tôi có bộ điều khiển tên là Snippets
cả trong khu vực mặc định (trong ứng dụng gốc) và trong khu vực của tôi được gọi là Manage
. Tôi sử dụng T4MVC và tùy chỉnh tuyến đường, như thế này:T4MVC và tên bộ điều khiển trùng lặp trong các khu vực khác nhau
routes.MapRoute(
"Feed",
"feed/",
MVC.Snippets.Rss()
);
Và tôi nhận được lỗi này:
Multiple types were found that match the controller named 'snippets'. This can happen if the route that services this request ('{controller}/{action}/{id}/') does not specify namespaces to search for a controller that matches the request. If this is the case, register this route by calling an overload of the 'MapRoute' method that takes a 'namespaces' parameter.
The request for 'snippets' has found the following matching controllers: Snippets.Controllers.SnippetsController Snippets.Areas.Manage.Controllers.SnippetsController
Tôi biết rằng có quá tải cho MapRoute
mà phải mất namespaces
cãi nhau, nhưng không có quá tải như vậy với Hỗ trợ T4MVC. Có thể tôi đang thiếu một cái gì đó? Cú pháp có thể có thể là:
routes.MapRoute(
"Feed",
"feed/",
MVC.Snippets.Rss(),
new string[] {"Snippets.Controllers"}
);
hay, có vẻ như khá tốt với tôi để có không gian tên là tài sản T4MVC:
routes.MapRoute(
"Feed",
"feed/",
MVC.Snippets.Rss(),
new string[] {MVC.Snippets.Namespace}
);
Cảm ơn trước!