.net - Unwrapping result of ApplyTo in ODataQueryOptions -


i have following function gets odataqueryoptions controller. should houseentities entity framework , return them. work "/odata/houses" "/odata/houses?$expand=persons" should output persons living in house not work.

this because "expand" changes applyto-function returns. seems "wrapped" "wrapperobject".

    public list<elci.businessentities.house> gethouses(odataqueryoptions qo)     {         yardentities cx = new yardentities();        //... mapper configuration omited ...          iqueryable<dataaccesslayer.house> query = qo.applyto(cx.houses) iqueryable<dataaccesslayer.house>;          list<businessentities.house> bhl = mapper.map<list<dataaccesslayer.house>, list<businessentities.house>>(query.tolist<dataaccesslayer.house>());         return bhl;     } 

does know how can "unwrap" them.

my house-entity looks this:

public partial class house {     [system.diagnostics.codeanalysis.suppressmessage("microsoft.usage", "ca2214:donotcalloverridablemethodsinconstructors")]     public house()     {         this.persons = new hashset<person>();     }      public int id { get; set; }     public string street { get; set; }     public string city { get; set; }      public virtual icollection<person> persons { get; set; } } 


Comments