wpf - Entity Framework-Getting value from navigational property -
i have 3 entities in model. a->b->c, super parent , c child. c derived b, , b derived a. loading c datagrid, , need able display values b , a. right can display values of b saying:
dgia.itemssource = ctx.c.oftype<some_type>().include("b");
and in xaml say:
<datagridtextcolumn header="property 1" binding="{binding a.name}"/> <datagridtextcolumn header="property 2" binding="{binding b.name}"/> <datagridtextcolumn header="property 3" binding="{binding frequency}"/>//a value in c
i need able display a.name, if try include saying:
ctx.c.oftype<some_type>().include("b").include("a");
i exception:
a specified include path not valid. entitytype 'db.some_type' not declare navigation property name 'a'.
i understand why doing this, entity c has navigational property b, , b has navigational property a, want c able value in way have shown. how this? thank much!
so saying in xaml:
<datagridtextcolumn header="property 1" binding="{binding b.a.name}"/>
this accessed nav property of b access a.
and:
dgia.itemssource = ctx.a.oftype<some_type>();
no includes or needed. apprently ef's 'relationship fix-up' handles it, need dot accessors.
Comments
Post a Comment