Skip to content
Browse files

Change search order to look for a view with the same name as the Requ…

…est DTO, before a name with the Response DTO
  • Loading branch information...
1 parent af4a0f7 commit 86d74952817efffb3f5ba0405b1e1f5c693f0552 @mythz mythz committed Nov 12, 2012
Showing with 9 additions and 1 deletion.
  1. +9 −1 src/ServiceStack.Razor/RazorFormat.cs
View
10 src/ServiceStack.Razor/RazorFormat.cs
@@ -357,14 +357,22 @@ private ViewPageRef GetViewPageByResponse(object dto, IHttpRequest httpReq)
if (!string.IsNullOrEmpty(viewName))
return GetViewPage(viewName);
+ //Since the Request DTO Name should be unique, look for a viewName with that first
+ if (httpReq != null && httpReq.OperationName != null)
+ {
+ var pageRef = GetViewPage(httpReq.OperationName);
+ if (pageRef != null)
+ return pageRef;
+ }
+
if (dto != null)
{
var responseTypeName = dto.GetType().Name;
var pageRef = GetViewPage(responseTypeName);
if (pageRef != null) return pageRef;
}
- return httpReq != null ? GetViewPage(httpReq.OperationName) : null;
+ return null;
}
public IViewPage GetView(string name)

0 comments on commit 86d7495

Please sign in to comment.
Something went wrong with that request. Please try again.