private static string GetKey <T>(WebViewPage viewPage) where T : AssetBase { string typeName = typeof(T).Name; const string separator = "_"; BuildManagerCompiledView compiledView = viewPage.ViewContext.View as BuildManagerCompiledView; string path = compiledView != null ? compiledView.ViewPath : viewPage.Request.Url.LocalPath; return(string.Concat(typeName, separator, path)); }
public static string GetViewPath(this IView view) { BuildManagerCompiledView buildManagerCompiledView = view as BuildManagerCompiledView; if (buildManagerCompiledView == null) { return(null); } else { return(buildManagerCompiledView.ViewPath); } }
private Type ResolveViewModelType(BuildManagerCompiledView view) { var viewType = BuildManager.GetCompiledType(view.ViewPath); var webViewPageType = viewType .GetBaseTypes() .FirstOrDefault(t => t.IsGenericType && t.GetGenericTypeDefinition() == typeof(WebViewPage <>)); if (webViewPageType != null) { return(webViewPageType.GetGenericArguments()[0]); } return(typeof(object)); }