Skip to content

Optional Parameters in Stored Procs #774

@NeilN1

Description

@NeilN1

Not sure if I can do this so asking here. Stored proc modifications are a regular thing and sometimes new arguments are added as optional so existing code can run unmodified. The stored proc:

CREATE PROC [dbo].[usp_ReferralGet](
    @referralId UNIQUEIDENTIFIER = NULL,
    @contactId UNIQUEIDENTIFIER = NULL,
    @fromDate DATETIME = NULL,
    @toDate DATETIME = NULL)

generates:

Task<List<UspReferralGetReturnModel>> UspReferralGetAsync(
    Guid? referralId,
    Guid? contactId,
    DateTime? fromDate,
    DateTime? toDate);

This means any call to that interface method has to change to explicitly pass all newly added arguments.

Is there a way to generate default values for arguments, so something like this is produced?

Task<List<UspReferralGetReturnModel>> UspReferralGetAsync(
    Guid? referralId = null,
    Guid? contactId = null,
    DateTime? fromDate = null,
    DateTime? toDate = null);

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions