Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Dapper.SqlBuilder/SqlBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ public string ResolveClauses(DynamicParameters p)
.Union(new[]
{
" ( " +
string.Join(" OR ", this.Where(a => a.IsInclusive).Select(c => c.Sql).ToArray()) +
string.Join(" OR ", this.Where(a => a.IsInclusive).Select(c => c.Sql)) +
" ) "
}).ToArray()) + _postfix
: _prefix + string.Join(_joiner, this.Select(c => c.Sql).ToArray()) + _postfix;
})) + _postfix
: _prefix + string.Join(_joiner, this.Select(c => c.Sql)) + _postfix;
}
}

Expand Down
4 changes: 2 additions & 2 deletions Dapper/DynamicParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -397,10 +397,10 @@ static void ThrowInvalidChain()
}
while (diving is not null);

var dynamicParamName = string.Concat(names.ToArray());
var dynamicParamName = string.Concat(names);

// Before we get all emitty...
var lookup = string.Join("|", names.ToArray());
var lookup = string.Join("|", names);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A "char" vs "string" can be used in Join() call.

Copy link
Author

@TimothyMakkison TimothyMakkison Dec 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm scared of getting nerd sniped here, but I'm pretty sure they do the same thing. string.Join(char and string.Join(string. both call JoinCore. The only difference is it converts the char into a Span via new ReadOnlySpan<char>(in separator) before calling JoinCore. Code here

I would love to know if the generated code is different between char and string

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, they are similar. I was thinking of semantic use of "char" with the explicit visibility purpose of a-single-char-operation :)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mgravell With lots of pull requests in the queue, are we going to have a new Dapper release any time soon? And, if you or your team needs assistance, how can it be possible?


var cache = CachedOutputSetters<T>.Cache;
var setter = (Action<object, DynamicParameters>?)cache[lookup];
Expand Down
2 changes: 1 addition & 1 deletion Dapper/SqlMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3498,7 +3498,7 @@ private static void GenerateDeserializerFromMap(Type type, DbDataReader reader,
var ctor = typeMap.FindConstructor(names, types);
if (ctor is null)
{
string proposedTypes = "(" + string.Join(", ", types.Select((t, i) => t.FullName + " " + names[i]).ToArray()) + ")";
string proposedTypes = "(" + string.Join(", ", types.Select((t, i) => t.FullName + " " + names[i])) + ")";
throw new InvalidOperationException($"A parameterless default constructor or one matching signature {proposedTypes} is required for {type.FullName} materialization");
}

Expand Down