Last post Jan 17, 2021 11:41 AM by Emre_TheDev
None
0 Points
2 Posts
Jan 17, 2021 09:24 AM|Emre_TheDev|LINK
Hello everyone;
EFCore has some confusions with my schema and I con not figure out how to solve.
WebSiteModel has two property;
public virtual ICollection<IconLinkModel> NavBarUpperLeftItems { get; set; }public virtual ICollection<IconLinkModel> NavBarItems { get; set; }
Normally, I should have 4 items in NavBarUpperLeftItems and 1 item in NavBarItems.
When I fetch data like that;
website = context .WebSites .Include(x => x.NavBarUpperLeftItems) .Include(x => x.NavBarItems) .FirstOrDefault(x => x.Domain == domain);
NavBarUpperLeftItems is empty and all items comes in NavBarItems. Is that a normal behaviour, how can I avoid that? PS: I am using MySQL, Pomelo driver and dotnetcore 5. Thanks.
Jan 17, 2021 11:41 AM|Emre_TheDev|LINK
I solved the problem by adding foreign key. Thanks
None
0 Points
2 Posts
Releation Between Two Columns With Multiple Object
Jan 17, 2021 09:24 AM|Emre_TheDev|LINK
Hello everyone;
EFCore has some confusions with my schema and I con not figure out how to solve.
WebSiteModel has two property;
Normally, I should have 4 items in NavBarUpperLeftItems and 1 item in NavBarItems.
When I fetch data like that;
NavBarUpperLeftItems is empty and all items comes in NavBarItems.
Is that a normal behaviour, how can I avoid that?
PS: I am using MySQL, Pomelo driver and dotnetcore 5.
Thanks.
None
0 Points
2 Posts
Re: Releation Between Two Columns With Multiple Object
Jan 17, 2021 11:41 AM|Emre_TheDev|LINK
I solved the problem by adding foreign key. Thanks