Hi!
I have database with simple structure:
markimaster(id, name), modelemaster(id, marka_id), typymaster(id, model_id)
I defined relationships between tables and fetch data with this code:
ObjectQuery<markimaster> markiQuery = context.markimaster.Include("modelemaster.typymaster");
bindingSourceMarki.DataSource = markiQuery;
Last line throws ArgumentNullException with ParamName:entity. When I change my code to this:
ObjectQuery<markimaster> markiQuery = context.markimaster.Include("modelemaster");
bindingSourceMarki.DataSource = markiQuery;
it work's (means doesn't throw exception), so i thought maybe there is row in typymaster that didn't have coresponding row in modelemaster, but checking database shows nothing.
Since I'm new to EntityFramework I have no idea what's wrong, so came here looking for advise ;)
[UPDATE]
I ran other query on my database:
select * from modelemaster where model_id not in (select model_id from typymaster)
which returns 2000 rows. So there are models that has no types.
[UPDATE]
This is fragment of my .edmx file
EntitySet Name="markimaster" EntityType="MMT_Master.store.markimaster" store:Type="Tables" Schema="public"
EntitySet Name="modelemaster" EntityType="MMT_Master.store.modelemaster" store:Type="Tables" Schema="public"
EntitySet Name="typymaster" EntityType="MMT_Master.store.typymaster" store:Type="Tables" Schema="public"
so it seems like names used in path passed to Include are correct