Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        public static string GetViewPath(this IView view)
        {
            BuildManagerCompiledView buildManagerCompiledView = view as BuildManagerCompiledView;

            if (buildManagerCompiledView == null)
            {
                return(null);
            }
            else
            {
                return(buildManagerCompiledView.ViewPath);
            }
        }
Ejemplo n.º 3
0
        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));
        }