when we have two tables with one to zero or one relationship. there might be records in tableA with no corresponding record in tableB.
So the Join Operation results null values for these records.
My Goal is to replace these Nulls with a defalut value.
My Question is How can we do this in Database Context And in C# Context(when we have standard c# collections instead of db tables) using linq?
Example Tables :
tableA{id , name , info}
tableB{id , tableAid , number}
Query:
var result= from a in tableA join b in tableB on b.tableAid equals a.id
select new {id = a.id , name = a.name , number = b.number }
number in the result may be null If there is no record in tableB for a specific record in tableA.
i need such a thing:
if(result[i].number==null)result[i].numer=1