odata - DataServiceContext don't read related entities into the entity object -
i'm making call odata v3 webapi, expanding related entities follow:
var cenarioinvestimentoescolhido = container.cenariodeinvestimentoescolha.expand("cenariodeinvestimentocenario,cenariodeinvestimentocenario/cenario,cenariodeinvestimentocenario/aeronave").where(c => c.cenariodeinvestimentocenario.cenariodeinvestimento.aerodromo.codigoicao.equals(idaerodromo)).singleordefault();
this absolute uri generated expression:
https://localhost/sac/webapi/odatawebapi/cenariodeinvestimentoescolha()?$filter=cenariodeinvestimentocenario/cenariodeinvestimento/aerodromo/codigoicao%20eq%20'snbr'&$top=2&$expand=cenariodeinvestimentocenario,cenariodeinvestimentocenario/cenario,cenariodeinvestimentocenario/aeronave
and result set responded api:
{ "odata.metadata":"https://localhost/sac/webapi/odatawebapi/$metadata#cenariodeinvestimentoescolha","value":[ { "cenariodeinvestimentocenario":{ "aeronave":{ "id":4,"codigo":"b738","nome":"737-800","idfabricante":3,"pmd":"80-90%","categoria":"4c" },"cenario":{ "id":3,"nome":"cen\u00e1rio 3" },"idaerodromo":112,"idcenario":3,"idaeronave":4,"categoriadeaeronave":"4c","subtotal":"39587651.01","eventualacrescimo":"3958765.10","total":"43546416.11" },"idaerodromo":112,"idcenario":3,"datainformadobancobrasil":"2014-03-11t00:00:00","numerooficio":"46/2014/seap/sac-pr","dataescolhasalamonitoramento":"2014-03-17t00:00:00","dataescolhasacpr":"2014-03-18t00:00:00" } ] }
as can see, there entity named cenariodeinvestimentocenario related entities aeronave , cenario. howevar, both child entites null after call, if they're not deserializated.
i checked response stream in receivingresponse event , indeed related information has been received. why properties null? serialization issue?
do have attribute above controller action ?
[enablequery(maxexpansiondepth = x)]
Comments
Post a Comment