Make optional arguments for Stored Procedures optional in the generated .NET method
See original GitHub issueProvide steps to reproduce
I have a stored procedure defined as follows:
create procedure dbo.SpMapGet(
@NodeId int,
@Debug int = null
) as begin
// ...
end
When I create the model for this using the version detailed below, the generated method has the following signature:
public virtual async Task<TResult> SpMapGetAsync(
int? NodeId,
int? Debug,
OutputParameter<int> returnValue = null,
CancellationToken cancellationToken = default)
{
// ...
}
What I would like to see is Debug
becoming an optional parameter there, too, just like in the SQL statement:
public virtual async Task<TResult> SpMapGetAsync(
int? NodeId,
- int? Debug,
+ int? Debug = null,
OutputParameter<int> returnValue = null,
CancellationToken cancellationToken = default)
{
// ...
}
Is this something that you would consider implementing?
Provide technical details
-
Exact Visual Studio version: Visual Studio 2022 17.6.5
-
EF Core Power Tools version: 2.5.1544
-
Database engine: SQL Server
-
EF Core version in use: EF Core 7
-
Is Handlebars used: no
-
Is T4 used: no
-
Is .dacpac used: ?
Issue Analytics
- State:
- Created 2 months ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Optional parameters in SQL Server stored procedure
You can declare it like this: CREATE PROCEDURE MyProcName @Parameter1 INT = 1, @Parameter2 VARCHAR (100) = 'StringValue', ...
Read more >Optional Parameters in Stored Procedure in SQL
In this article I will demonstrate how to use optional parameters in a Stored Procedure in SQL.
Read more >Optional vs Required parameters in Stored Procedures
Fortunately, it's pretty easy to make some parameters required and others optional. You simply give them a default value. 1. 2. 3. 4....
Read more >Handling optional parameters in stored procedure
I have a stored procedure, say "Test" with an optional parameter @Param1 int = NULL. In the procedure, the value of @Param1 is...
Read more >Create stored procedure that accepts optional parameter in ...
To create optional parameter in stored procedure, we set the parameter value to NULL while creating a stored procedure. CREATE PROCEDURE [dbo].
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for looking into this, @ErikEJ. It’s a pitty, there’s no info about this.
You are welcome.
If you like my free tools, I would be very grateful for a rating or review on Visual Studio Marketplace or even a one-time or monthly sponsorship