HI,
I have Ling Table with MyObject.
It has got fields:
Id Number Name
There is a method that adds ne MyObject to Database. In partial class MyOBject Im implementing OnValidate method. I need to check if there is already a row with such number and name.
The problem is where this values are nulls (for this example both can be)
var result = from m in myContext.MyObjects where m.Number == this.Number &&
m.Name == this.Name
select m;
if(result.Count > 0) {
throw ...
}
if for example this.Name = null and r.Name = null and m.Number == this.Number no rows are selected and I dont know why :/
Any hints on how can I check if row with excactly the same values in fileds except Id (which is PK) are already in database ?
Thanks for help