Fixed combination of Display Templated Helpers.
Had to make adjustments to allow the project to build (things that were missed by git). Also made some changes to ensure it builds in CoreCLR.
This commit is contained in:
parent
671c7dd59e
commit
c0d06f1fbc
|
|
@ -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<Type, bool> 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;
|
||||
|
|
|
|||
|
|
@ -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; }
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue