R – Prevent nullable parameter in stored procedure with LINQ

asp.netlinqstored-procedures

I want to define stored procedure parameters which do not allow null arguments.

alt text http://www.pixelshack.us/images/xg3mr2xw0q13z22nal.jpg

That @MailItemId int OUTPUT will be not nullable because when I import the stored procedure into the LINQ to SQL designer it says @MailIetmid is ref int? mailItemId.

alt text http://www.pixelshack.us/images/er80hukg27lreiy9b83y.jpg

Thanks.

Best Answer

If nothing else, you can just modify the auto-generated code (in designer.cs) to not accept a nullable integer. If the parameter ever does end up being null, it will probably cause a weird exception down in the LINQ to SQL code, but that's not a huge deal.