Permalink
Browse files

ViewModel suffix as convention for page models

  • Loading branch information...
OlexaLe committed Jan 27, 2016
1 parent 25e2655 commit 09490ffc293e8d51befc5b7c50a0becefb270413
Showing with 8 additions and 1 deletion.
  1. +8 −1 src/FreshMvvm/FreshPageModelResolver.cs
@@ -31,7 +31,7 @@ public static Page ResolvePageModel (Type type, object data)
public static Page ResolvePageModel (Type type, object data, FreshBasePageModel pageModel)
{
var name = type.AssemblyQualifiedName.Replace ("Model", string.Empty);
var name = GetPageTypeName (type);
var pageType = Type.GetType (name);
if (pageType == null)
throw new Exception (name + " not found");
@@ -47,6 +47,13 @@ public static Page ResolvePageModel (Type type, object data, FreshBasePageModel
return page;
}
private static string GetPageTypeName (Type pageModelType)
{
return pageModelType.AssemblyQualifiedName
.Replace ("PageModel", "Page")
.Replace ("ViewModel", "Page");
}
}
}

0 comments on commit 09490ff

Please sign in to comment.