Access properties of linked entityreference with early bound or strongly typed class RRS feed

  • Question

  • Hi @ All,

    i queried a entity which is a strongly typed class and these are alle Attributes of the entity.

    Count = 48
        [0]: "prg_eavpositonneuerversorger"
        [1]: "statecode"
        [2]: "prg_dienstleistungenid"
        [3]: "prg_eavpositionneuevertragslaufzeit"
        [4]: "prg_eavpositioneinsparung"
        [5]: "statuscode"
        [6]: "prg_name"
        [7]: "prg_eavpositionabnahmestelle"
        [8]: "prg_einzelpreis"
        [9]: "prg_lieferstelle1.owninguser"
        [10]: "createdon"
        [11]: "prg_eavpositionepa"
        [12]: "ownerid"
        [13]: "modifiedon"
        [14]: "prg_lieferstelle1.modifiedon"
        [15]: "prg_istderpreisueberschrieben"
        [16]: "transactioncurrencyid"
        [17]: "prg_lieferstelle1.modifiedby"
        [18]: "prg_eavpositionlieferstellen"
        [19]: "exchangerate"
        [20]: "timezoneruleversionnumber"
        [21]: "prg_abrechnungspositionid"
        [22]: "prg_lieferstelle1.createdby"
        [23]: "modifiedby"
        [24]: "prg_lieferstelle1.createdon"
        [25]: "prg_lieferstelle"
        [26]: "prg_einzelpreis_base"
        [27]: "prg_lieferstelle1.prg_name"
        [28]: "prg_eavpositioneinsparung_base"
        [29]: "prg_lieferstelle1.prg_medium"
        [30]: "prg_menge"
        [31]: "prg_lieferstelle1.prg_lieferstelleid"
        [32]: "prg_postentext"
        [33]: "prg_betrag_base"
        [34]: "prg_betrag"
        [35]: "prg_lieferstelle1.prg_kategorie"
        [36]: "createdby"
        [37]: "prg_lieferstelle1.statecode"
        [38]: "prg_lieferstelle1.prg_lieferstellenid"
        [39]: "owningbusinessunit"
        [40]: "prg_belegid"
        [41]: "owninguser"
        [42]: "prg_istdasproduktueberschrieben"
        [43]: "prg_lieferstelle1.owningbusinessunit"
        [44]: "prg_lieferstelle1.statuscode"
        [45]: "prg_eigenesprodukt"
        [46]: "prg_eavpositiondatumergebnisdarstellung"
        [47]: "prg_lieferstelle1.ownerid"

    [25]: "prg_lieferstelle" => is a entityreference and i included also the values of this entityreference into the result. All Attributes like "prg_lieferstelle1.prg_kategorie" or "prg_lieferstelle1.ownerid" belongs to this entityreference of type "prg_lieferstelle".

    with "entity.ToEntity<prg_abrechnungsposition>()" i get the strong type object of the entity.

    I can access the the values of "prg_lieferstelle" with entity["prg_lieferstelle1.prg_kategorie"] but how can i early bind these attributes to an object of type "prg_lieferstelle" ?

    Kind Regards


    Tuesday, February 11, 2014 5:08 PM

All replies

  • Hi Markus, As far as I know there is no way to automatically deserialize these aliased values into the early bound entities when returned in this way. You could create a custom mechanism fairly easily for your specific scenario, but to make it generic you would need to query meta data and parse the query. Maybe an easier approach would be to use lazy loading of relationships. See http://develop1.net/public/post/MicrosoftXrmClient-Part-1.aspx

    Hope this helps,


    Scott Durow
    Blog www.develop1.net    Follow Me
    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

    Tuesday, February 11, 2014 8:02 PM