Skip to content

Optional Paramaters #116

Open
Open

Description

@rscole

I have created a method on an ApiController with optional parameters:

Public void getInformation(int? id1 = null, int? id2 = null){
}

When generating the proxy code, the method in WebApiProxy.generated.cs is:

Void getInformation(Nullable<Int32> id1, Nullable<int32>id2);

I would like to call this method with any of the following:

getInformation(1,2);
getInformation(1);
getInformation();

Currently I have to call this method with nulls for it to work:

getInformation(1,null);
getInformation(null,null);

Is there something I can do or can be changed so I can call this method without passing it null values?

Activity

  1. swethapavan commented on Nov 4, 2016

    @swethapavan

    How about creating overloaded methods in the controller and these overloaded methods in turn call a single private method having the optional parameters.

  2. The-Futurist commented on Jun 10, 2017

    @The-Futurist

    @swethapavan @faniereynders @rscole - This strikes me as a an obvious no-brainer, the proxy signature is clearly wrong and there should be no need for the client to do any hacking/fiddling with overloads. This issue also seems to be rather old so I wonder - why should we consider using WebApiProxy if issues like these are being simply ignored?

    I'm considering using this (or something like it) but all too often these open source projects become a burden because users end up self-maintaining their fork versions because the base repo simply falls behind.

    I'd expect an issue like this to be treated more quickly and I suspect (without looking at the code) that it isn't a huge change - so why has it been ignored for 9 months?

  3. faniereynders commented on Jun 10, 2017

    @faniereynders
    Member
  4. The-Futurist commented on Jun 10, 2017

    @The-Futurist

    @faniereynders - I'd consider forking etc but then I see old PRs like this:

    #117

    Which seem like a basic and simple improvement but there's no comment from you, this give me the feeling that if I did get involved and go to the trouble of creating some pull requests, they'd sit there for months, apparently ignored by you.

  5. faniereynders commented on Jun 10, 2017

    @faniereynders
    Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions