System.ArgumentException is thrown when passing empty SqlDataRecord list as an anonymous object or as table-valued parameter to Dapper.
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 18.4k
- Forks
- 3.7k
- Avg merge
- 5h 8m
- Merged PRs (30d)
- 1
Description
The following exception is thrown when I try to execute stored procedure through Dapper and passing
SqlDataRecordListTVPParameter implementation of the interface ICustomQueryParameter. The code looks like this :
Proposed fix which worked for me : https://github.com/StackExchange/Dapper/pull/900/files
CommandDefinition commandDefinition =
new CommandDefinition(
query,
new DynamicParameters(new IEnumerable<SqlDataRecord>(){ }).AsTableValuedParameter(),
null,
null,
CommandType.StoredProcedure);
var result= connection.Query<int>(commandDefinition ).ToList();
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the SqlDataRecordListTVPParameter implementation of ICustomQueryParameter and compare the proposed fix in PR 900; reproduce the empty IEnumerable call shown in the issue. Done means executing the stored procedure with an empty table-valued parameter no longer throws System.ArgumentException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, sql
- Domain
- database
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100