- 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] CodeBuilderContext codeBuilderContext,
[NotNull] Action<CSharpCodeWriter> renderAttributeValue) [NotNull] Action<CSharpCodeWriter> renderAttributeValue)
{ {
var propertyType = attributeDescriptor.PropertyInfo.PropertyType; if (attributeDescriptor.TypeName.Equals(_context.ModelExpressionTypeName, StringComparison.Ordinal))
if (propertyType.FullName.Equals(_context.ModelExpressionTypeName, StringComparison.Ordinal))
{ {
writer.WriteStartMethodInvocation(_context.CreateModelExpressionMethodName) writer.WriteStartMethodInvocation(_context.CreateModelExpressionMethodName)
.Write(ModelLambdaVariableName) .Write(ModelLambdaVariableName)

View File

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