This question is locked. New answers and comments are not allowed.
Hi all,
The code snippet below always results in an object reference error and I can'f figure out why.
If I change the code so that I query an OpenAccess context like '
The code snippet below always results in an object reference error and I can'f figure out why.
IQueryable<Product> categoryProducts = currentCategory.ProductsInChildCategories;
var products = (from p
in
categoryProducts
join cp
in
context.CustomerPrices on p.ProductId equals cp.ProductId
where p.LockedSince.Equals(
null
)
&& (customerIdForPrices <= 0 || cp.CustomerId == customerIdForPrices)
&& cp.MinimumQuantity == 0
&& (manufacturerId <= 0 || p.ManufacturerId == manufacturerId)
&& (!HideCombinationProducts || !p.IsCombination)
&& (eANCode == String.Empty || p.EANCode.Contains(eANCode))
&& (onStock <= 0 || p.OnStock > 0)
select
new
{
ProductId = p.ProductId,
Name = p.Name,
Description = p.Description,
ActionPrice = cp.ActionPrice,
Price = cp.Price,
});
If I change the code so that I query an OpenAccess context like '
from p
in
context.Products', it works perfectly.
Any idea what's going wrong?