-
Notifications
You must be signed in to change notification settings - Fork 934
Optimize usages of SqlString.Append #2166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Append operations would be best served with an additional SqlString constructor
return new SqlString(this, text); | ||
} | ||
|
||
public SqlString Append(params object[] parts) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would consider introducing a new private SqlString(SqlString other, params object[] parts)
constructor which can optimise the parts copying and append operations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I've considered such ctor. But looking at existing ctors SqlString(SqlString x)
and SqlString(params object[] parts)
- I didn't find a way to merge them nicely. So IMHO it's not worth it. But if you've come up with implementation - feel free to add it.
Each
SqlString.Append
call leads to newSqlString
creation. And calledSqlString
ctor doesn't look lightweight to me. So let's minimize subsequent Append calls.