1
I’m trying to get the value of a property through Expression
, but I’m getting the following error.
The instance property '.Rota.Applicationname' is not defined for the guy 'System.Data.Entity.DynamicProxies.Filaraiz_93343013d3bb166e625f779b61fc319eeb1bbb98d8e88250da9549af70a0c8'
My implementation I’m trying to do is as follows.
private string ObterValorDoObjeto(Object obj, string propriedade)
{
Expression propertyExpr = Expression.Property(
Expression.Constant(obj),
propriedade
);
return Expression.Lambda<Func<string>>(propertyExpr).Compile()();
}
And her call.
var TemplateDeURI = ObterValorDoObjeto(fila, ".Rota.NomeDaAplicacao");
My object fila
has a navigation object (Class) Rota
who owns the property NomeDaAplicacao
, and that’s the property I want to get value for,, but I’m not getting it.
Path is another class within the instance object type
fila
?– Leandro Angelo
@Leandroangelo, that’s right public Rota Rota { get; set; }
– Marco Souza
I understand, you will need to make a recursion or reflection to navigate between the objects
– Leandro Angelo