I created this console application to reproduce my problem
static void Main(string[] args)
{
var obj = new object[] {
new { Id= 36,
Descricao= "Responsiva",
Tipo=new { Id= "1" },TipoId= "1" ,
Custo= 160
},
new {
Id= 31,
Descricao= "Log",
Tipo= new { Id= "1" },TipoId= "1" ,
Custo= 0
},
new {
Id= 32,
Descricao= "Multi-Idioma",
Tipo= new { Id= "2" },TipoId= "2" ,
Custo= 2
},
new {
Id= 33,
Descricao= "Tela Administrativa",
Tipo= new { Id= "2" },TipoId= "2" ,
Custo= 8
}
};
var json = Newtonsoft.Json.JsonConvert.SerializeObject(obj);
var dados = Newtonsoft.Json.JsonConvert.DeserializeObject<Newtonsoft.Json.Linq.JObject[]>(json);
var retorno = dados.AsQueryable()
.Select("new ( string(Id) as Id, string(Descricao) as Descricao,new ( string(Id) as Id) as Tipo, string(TipoId) as TipoId, string(Custo) as Custo)");
retorno = retorno.OrderBy("Descricao asc");
var retorno1 = retorno.Where("(TipoId = @0)", "1");
var retorno2 = retorno.Where("(Tipo.Id = @0)", "1");
Console.WriteLine(retorno.Count());
Console.WriteLine(retorno1.Count());
Console.WriteLine(retorno2.Count());
Console.ReadLine();
}
If you look at the results , the count should be the same, but for some reason, retorno2 is filtering for the Root Id of the object, and not the Tipo property and Id SubProperty
I created this console application to reproduce my problem
If you look at the results , the count should be the same, but for some reason, retorno2 is filtering for the Root Id of the object, and not the Tipo property and Id SubProperty