6
Vote

Support method overloads for default parameters with Database first

description

When using Database first to generate a model from an existing database for stored procedures, only a single method call is generated that does not take into account default parameters the stored procedure may have. This effectively means there is no way to call mapped stored procedures without having to write the code by hand, negating the point of generating a model from the data

comments

RoMiller wrote Jan 23, 2013 at 11:59 PM

EF Team Triage: We are only taking minimal changes to the designer in EF6 because we are still converting the code base to open source. We'll consider this bug for the next release.

moozzyk wrote Jan 24, 2013 at 4:36 PM

I wonder if we could just use default parameters instead of overloads.

MgSam wrote Jan 24, 2013 at 5:16 PM

@moozzyk The problem with that is that it's brittle. If the default parameters change in the database, the generated code would unknowingly be passing the old, wrong default parameters. It's more robust to just generate overloads in which the proc is called without those parameters for which there are defaults.

Upshon wrote May 30, 2013 at 10:58 AM

Surely if the SP Param is marked as Nullable and you pass in null as value when you execute the SP you just Pass DBNull.Value not null?