- TagHelperAttributeDescriptors changed to be lighterweight and not depend on PropertyInfo, had to modify our use of them to work with the new contract.
This commit is contained in:
NTaylorMullen 2014-11-15 12:56:47 -08:00 committed by N. Taylor Mullen
parent 10f7234c61
commit 1cf6607e75
2 changed files with 2 additions and 6 deletions

View File

@ -34,9 +34,7 @@ namespace Microsoft.AspNet.Mvc.Razor
[NotNull] CodeBuilderContext codeBuilderContext,
[NotNull] Action<CSharpCodeWriter> renderAttributeValue)
{
var propertyType = attributeDescriptor.PropertyInfo.PropertyType;
if (propertyType.FullName.Equals(_context.ModelExpressionTypeName, StringComparison.Ordinal))
if (attributeDescriptor.TypeName.Equals(_context.ModelExpressionTypeName, StringComparison.Ordinal))
{
writer.WriteStartMethodInvocation(_context.CreateModelExpressionMethodName)
.Write(ModelLambdaVariableName)

View File

@ -26,9 +26,7 @@ namespace Microsoft.AspNet.Mvc.Razor
ModelExpressionTypeName = modelExpressionType,
CreateModelExpressionMethodName = "SomeMethod"
});
var propertyInfo = new Mock<PropertyInfo>();
propertyInfo.Setup(mock => mock.PropertyType.FullName).Returns(propertyType);
var attributeDescriptor = new TagHelperAttributeDescriptor("MyAttribute", propertyInfo.Object);
var attributeDescriptor = new TagHelperAttributeDescriptor("MyAttribute", "SomeProperty", propertyType);
var writer = new CSharpCodeWriter();
var generatorContext = new CodeGeneratorContext(host: null,
className: string.Empty,