React to aspnet/Razor#214 changes.
- 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:
parent
10f7234c61
commit
1cf6607e75
|
|
@ -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)
|
||||||
|
|
|
||||||
|
|
@ -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,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue