Linq not loading entire object
Clash Royale CLAN TAG#URR8PPP
Linq not loading entire object
I'm using LINQ for quite some time now and I've never seen anything like this:
Item.SelectedBusinessUnit
should be equal to BusinesssUnits.First()
, but it only equals in one property.
Item.SelectedBusinessUnit
BusinesssUnits.First()
Here the code:
item.BusinessUnits = BusinessUnits;
item.Units = Units;
item.SelectedBusinessUnit = BusinessUnits.First();
item.Element4CostCenter = item.CostCenters.Where(c => c.Id == item.Element4CostCenter.Id).FirstOrDefault();
item.Unit = item.Units.Where(u => u.Id == item.Unit.Id).FirstOrDefault();
Any ideas what is going on?
Please post the code you are having difficulty with (not an image). It is hard to assist in understanding the problem without an actual example of the issue.
– Justin Pearce
Aug 7 at 19:43
@Sidron That doesn't really provide any useful guidance. How should he edit the post (and why)?
– Rufus L
Aug 7 at 19:44
@Rufus L I can't see an image :/ Maybe its my browser
– Sidron
Aug 7 at 19:47
If I understood correctly, the issue is that "Name", "OrderItems" and "Orders" are null? If so, is impossible to help you without more details. Show us the code, show us where BusinessUnits is populated.
– Natassia Tavares
Aug 7 at 19:52
1 Answer
1
Maybe you have some problem with lazy loading. Have you tried to evaluate result by using toList() (assuming that BusinessUnits is IEnumerable) ?
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Please edit your post
– Sidron
Aug 7 at 19:42