views:

69

answers:

1

Hi folks, whenever i drag-n-drop a stored procedure onto my Context canvas, the parameters/arguments for the stored procedure are all nullable.

Why is this? Is it because of how i've declared my parameters inside the stored procudure itself?

Besides manually creating my stored procedure methods in the Context partial class (or drag-n-drop onto canvas, cut from autogen'd code, move to partial class, then remove nullables types) .. is there any way to fix this?

It's really frustrating :(

+2  A: 

Parameters to stored procedures are always nullable (there's no equivalent to the "NOT NULL" clause you can add to a column in a table), so Linq to SQL has little choice but to reflect that in its generated methods.

Your best bet is to check (in the proc itself) if NULL has been passed and either raise an error or substitute it with a default value.

Matt Hamilton
So there's nothing i can define in the store proc to say "This argument CANNOT be NULL ?"
Pure.Krome
I don't believe so, no. Would love to be proven wrong! :)
Matt Hamilton
All you can do is check for NULL in the proc and exit and/or RAISEHELL, err ERROR.
edosoft