-- tbl_region-- id displayname description isusinglinenumbers waitperiod fk_stateid 1 ups upstate 0 10 1 2 dwn downstate 1 20 1 3 ok oklahoma 1 15 2 -- clientidentifier-- id clientid fk_regionid 1 prci1 1 2 prci2 2 3 prci3 3 var clientidentifier = session.queryover<clientidentifier>() .where(x => x.clientid == clientid).joinqueryover(x=>x.region) .singleordefault(); this query throwing exception when clientid not valid. how can avoid ?
if need deal nullables properties in queries can use this:
var query = session.queryover<clientidentifier>() if (clientid == null) query = query.whererestrictionon(x => x.clientid).isnull; else query = query.where(x => x.clientid == clientid); var clientidentifier = query.joinqueryover(x => x.region) .singleordefault();
Comments
Post a Comment