Default values for parameters of SP methods.

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
peterharris
Posts: 13
Joined: Fri 03 Jan 2014 11:13

Default values for parameters of SP methods.

Post by peterharris » Tue 19 Aug 2014 10:15

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

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Default values for parameters of SP methods.

Post by MariiaI » Wed 20 Aug 2014 10:34

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.

peterharris
Posts: 13
Joined: Fri 03 Jan 2014 11:13

Re: Default values for parameters of SP methods.

Post by peterharris » Wed 20 Aug 2014 11:36

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.).

Post Reply