I'm trying to Convert the Uint(i_Customer) to a Nullable Int(i_Customer) ID Since one is accepting the Null value and the other ID Doesn't support.
The parent table is Customer(i_Customer) and the Child is Fault(i_customer). Both, I'm Joining them in a EF Query to get the result. But There is an nullreferenceexception was unhandled by user code
Exception that's very disturbing. How Would I fix it?
Here is the EF Query:
if (servicelevel == 3)
{
result = (from s in res
join cInfo in custInfo on
s.fault.i_customer equals Convert.ToInt32((int?)cInfo.customers.i_Customer)
where (s.fault.resolved == null) || (s.tasks.assignedto == agent)
orderby s.fault.ispriority descending, s.fault.logtime ascending
select new ActiveFaultResult()
{ Company_Name = cInfo.customers.Company_Name,
//replies = replies,
idFaults = s.fault.idFaults,
hashvalue = s.fault.hashvalue,
responsible = s.fault.responsible,
logtime = s.fault.logtime,
isinternal = s.fault.isinternal,
ispriority = s.fault.ispriority
}).ToList<ActiveFaultResult>();
// var limitresult = result.Take(50);
return result;
}