i have created a method where i join two sql tabels, with linq. when i debug and step into the method and i call it i can see that it is not null. But for som reason i am getting a nullreference when calling it.
Here is the method that i am calling.
public ItemIdentity GetIdentityInfo(int tradeItemId)
{
var query = (from item in _db.TradeItems
join identity in _db.ItemIdentities on item.itemIdentities equals identity.id
where item.id == tradeItemId
select identity);
return query as ItemIdentity;
}
And here is where i am calling it.
var tradeItemUnitDescriptor = GetIdentityInfo(tradeItemId).tradeItemUnitDescriptor;
is it not possible to call it like this?