I have a case where I have a linq2sql dbml with 2 table in it
let simplify this by:
Table1
id int not null
fkid int not null (to table2.id)
and
Table2
id int not null
v1 bit not null
in the generated dbml, fkid is not the type nullable and by default it's value is 0
but in table2, I don't have an id 0
when i'm trying to insert a new record without touching fkid field, I'm getting an SQL insert error saying: 0 doesn't exist into table2
thing is I want to make to make my check fully generic so I cannot just do something like:
if column doesn't allow null check if value is 0 and if it's the case throw a custom error
I would like to do something like: if column is null then throw "my custom error"
how would you implement that?