-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
AsSplitQuery with SqlParameter through FromSql #22483
Comments
I looked at DbParameter. DbParameter does not have clone method. (SqlParameter/NpgSqlParameter provides it through ICloneable). Not using DbParameter and passing actual values work fine. WIthout using AsSplitQuery also works fine. When context level default is split query but query is not executing additional command that scenario also works fine. We could have solution that if sqlParameter implements ICloneable, we clone it if not then let it fail because we don't have a way to deal with it. |
So sqlite is the only one which does not implement |
Submitted a PR to clone the parameter when ICloneable is implemented. |
Thanks to @Tasteful - The code snippet they shared gave the idea that we can clone it whenever the parameter implements |
Hit the headwall. When it is out parameter then by cloning we don't get value back. Perhaps, we should just block this scenario as we cannot make it work for all. |
Heck no. That behavior makes no sense on SQLite since there are no output parameters--they're all read-only, and I am 💯 against artificial constraints. |
But I'd be happy to implement a Clone method... (just not by implementing ICloneable) |
If the lack of throwing is not a bug then Sqlite can remain as is. It does not affect query. |
In my original code I'm actual checking if the parameter is an SqlParameter and in that case using reflection to see if the parameter already is attached to a command and in that case clone, otherwise we using the original parameter. I understand that using reflection like this is not good and it may introduce errors if the SqlParameter is changed internal in next version. My use case when passing in a an |
using System; namespace superkk.Data
I have issue with this parameter |
#11370 with AsSplitQuery
The text was updated successfully, but these errors were encountered: