Commit 88348bd2 authored by Fabien Barbier's avatar Fabien Barbier Committed by Nick Craver

Fallback to Enumerable.Any() for detecting empty table-valued parameters.

parent 5bf9488c
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
namespace Dapper
{
......@@ -32,7 +33,7 @@ void SqlMapper.ICustomQueryParameter.AddParameter(IDbCommand command, string nam
internal static void Set(IDbDataParameter parameter, IEnumerable<Microsoft.SqlServer.Server.SqlDataRecord> data, string typeName)
{
parameter.Value = (object)data;
parameter.Value = data != null && data.Any() ? data : null;
if (parameter is System.Data.SqlClient.SqlParameter sqlParam)
{
sqlParam.SqlDbType = SqlDbType.Structured;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment