KEMBAR78
SqlServer: string.IsNullOrWhiteSpace translation is overly complex · Issue #22916 · dotnet/efcore · GitHub
Skip to content

SqlServer: string.IsNullOrWhiteSpace translation is overly complex #22916

@bricelam

Description

@bricelam

Today, we translate this as @value IS NULL OR LTRIM(RTRIM(@value)) = N''. But I have a few questions:

  1. Why do we trim both the start and the end? Just one would produce the same result with less processing.
  2. More importantly, why do we trim at all? As we know from our StartsWith research, N' ' = N'' returns true in SQL Server.

IMHO, the translation should be @value IS NULL OR @value = N''

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions