Page 1 of 1

Default values for parameters of SP methods.

Posted: Tue 19 Aug 2014 10:15
by peterharris
Hi,

I am using VB.NET and PostgreSQL. When I add an SP to my model as a method, is there a way that the parameters of this method be given default values? Or is there a way to have nullable values have their default value set to Nothing?

Right now, as far as I'm aware, if I call a method on my context object I have to specify each parameter as Nothing, rather than the parameters being Nothing unless specified otherwise (and therefore falling back to the default value set in the SP).

Is there a way to achieve this?


Many thanks,

Peter

Re: Default values for parameters of SP methods.

Posted: Wed 20 Aug 2014 10:34
by MariiaI
peterharris wrote: Is there a way to achieve this?
Unfortunately, there is no way at the moment.
If you have any further questions, feel free to contact us.

Re: Default values for parameters of SP methods.

Posted: Wed 20 Aug 2014 11:36
by peterharris
OK, my solution at the moment is to set the method as protected internal and extend the context class using a partial class, and create a public method with optional parameters and their defaults set to nulls, which in turn calls the protected method generated by Entity Developer and returns the IQueryable object.

It's a little messy, and a way to do this from within Entity Developer would be better, but I can see how this would not be as easy to implement as it seems (because, e.g., all parameters specified after an optional parameter need to be optional with default values also, etc.).