Skip to content

Separate methods for raw SQL that leverage interpolated strings #10996

@divega

Description

@divega

Currently the behavior is different if you call FromSql or ExecuteSqlCommand with an inline interpolated string (parameterization happens) or if you assign the interpolated string to a variable and then pass it to the method (the string is formatted with the arguments).

In some cases customers expect parameterization but it doesn't happen: #10080

In other cases customers expect parameterization not to happen, but it does happen: #10956

This is very confusing and hard to explain. Interpolated strings in C# were simply not designed in a way that works well with having two overloads of the same method in which one works with interpolated strings and the other one with a regular string.

I think we should separate the methods, but we can only do this in major release because it is a breaking change.

This would also imply removing the RawSqlString type.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions