diff --git a/src/Common/TypeExtensions.cs b/src/Common/TypeExtensions.cs index 10b2777d9d..ad9c327374 100644 --- a/src/Common/TypeExtensions.cs +++ b/src/Common/TypeExtensions.cs @@ -36,6 +36,11 @@ namespace Microsoft.AspNet.Mvc } #endif + public static Type BaseType([NotNull] this Type type) + { + return type.GetTypeInfo().BaseType; + } + public static Type ExtractGenericInterface([NotNull] this Type queryType, Type interfaceType) { Func matchesInterface = t => t.IsGenericType() && t.GetGenericTypeDefinition() == interfaceType; @@ -59,6 +64,11 @@ namespace Microsoft.AspNet.Mvc } #endif + public static bool IsEnum([NotNull] this Type type) + { + return type.GetTypeInfo().IsEnum; + } + public static bool IsGenericType([NotNull] this Type type) { return type.GetTypeInfo().IsGenericType; diff --git a/src/Microsoft.AspNet.Mvc.Rendering/Html/HtmlHelper.cs b/src/Microsoft.AspNet.Mvc.Rendering/Html/HtmlHelper.cs index 272bdf1c58..dc0011e0f8 100644 --- a/src/Microsoft.AspNet.Mvc.Rendering/Html/HtmlHelper.cs +++ b/src/Microsoft.AspNet.Mvc.Rendering/Html/HtmlHelper.cs @@ -42,8 +42,6 @@ namespace Microsoft.AspNet.Mvc.Rendering IdAttributeDotReplacement = "_"; } - public IModelMetadataProvider MetadataProvider { get; private set; } - public string IdAttributeDotReplacement { get; set; } public HttpContext HttpContext { get; private set; } diff --git a/src/Microsoft.AspNet.Mvc.Rendering/Html/TemplatedHelpers/TemplateRenderer.cs b/src/Microsoft.AspNet.Mvc.Rendering/Html/TemplatedHelpers/TemplateRenderer.cs index 6731ae1f10..27df81f5db 100644 --- a/src/Microsoft.AspNet.Mvc.Rendering/Html/TemplatedHelpers/TemplateRenderer.cs +++ b/src/Microsoft.AspNet.Mvc.Rendering/Html/TemplatedHelpers/TemplateRenderer.cs @@ -43,7 +43,7 @@ namespace Microsoft.AspNet.Mvc.Rendering var fullViewName = modeViewPath + "/" + viewName; // Forcing synchronous behavior so users don't have to await templates. - var viewEngineResult = _viewEngine.FindPartialView(_viewContext.ViewEngineContext, fullViewName).Result; + var viewEngineResult = _viewEngine.FindPartialView(_viewContext.ViewEngineContext, fullViewName); if (viewEngineResult.Success) { using (var writer = new StringWriter(CultureInfo.InvariantCulture)) @@ -105,7 +105,7 @@ namespace Microsoft.AspNet.Mvc.Rendering else if (!metadata.IsComplexType) { // IsEnum is false for the Enum class itself - if (fieldType.IsEnum) + if (fieldType.IsEnum()) { // Same as fieldType.BaseType.Name in this case yield return "Enum"; @@ -117,7 +117,7 @@ namespace Microsoft.AspNet.Mvc.Rendering yield return "String"; } - else if (fieldType.IsInterface) + else if (fieldType.IsInterface()) { if (typeof(IEnumerable).IsAssignableFrom(fieldType)) { @@ -132,7 +132,7 @@ namespace Microsoft.AspNet.Mvc.Rendering while (true) { - fieldType = fieldType.BaseType; + fieldType = fieldType.BaseType(); if (fieldType == null) { break;