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 type 'System.Data.Entity.DynamicProxies.FilaRaiz_9328343013D3BB166E625F779B61FC319EEB1BBB98D8E88250DA9549AF70A0C8'
My implementation that 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
that has property NomeDaAplicacao
, and this property I want to get the value , but I'm not getting it.