-
-
Notifications
You must be signed in to change notification settings - Fork 499
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
Parameter count mismatch error when running InsertGetIdAsync<int> #331
Comments
could you please post a reproducible example? |
I have attached the code that produces the error for me, I hope it is clear enough. |
@hussamelvani I still can't reproduce it, can't help without sharing a workable project so I can investigate it more, |
@ahmad-moussawi I will try to reproduce it in a new project and get back to you because it is in a very big project that i unfortunately cannot share. |
The issue is that the Dictionary is being cast down to an object going from the async extension execution class to the Query.Insert.AsInsert method and then the object is trying to be converted back into a dictionary, calling reflection methods on that dictionary thinking it's an object with properties that may have data annotations. I think you just need to add an overload method explicitly for that dictionary type. |
@bmcmillan I solved the issue by removing the Dictionary and typing the parameters one by one instead of passing them as a parameter, and that basically solved my problem. |
Hi, Getting the same issue. Code as below:
As others have said above - this is due to a dictionary being passed in (cannot replicate if I pass in a dynamic object). Any suggestions on how to overcome this issue? Changing from a Dictionary is not an option for me in this project. |
…nc which takes a ReadOnlyDictionary.
Sumitted a Pull request - I have confirmed the changes made resolve the issue. |
Thanks guys, I merged @RichardAnderson's PR now. |
I am using the following line of code to insert a record into DB,
employeesInformation
parameter is of typeDictionary<string, object>
and has 33 parameters.await sqlKataDB.Query("TBL_EMPLOYEES_INFORMATION").InsertGetIdAsync<int>(employeesInformation);
I am getting Parameter count mismatch error. As far as I have seen online, this error occurs when you Invoke a delegate function with wrong parameters (I am not sure here). I tried making the fuction sync instead of async but that didn't help.
I saw an open StackOverFlow ticket with the same error but with no answer, the OP was intructed to get RawSql and Bindigns, I can get you that if that helps (But I don't know how, instructions would be great!)
Any suggestions?
The text was updated successfully, but these errors were encountered: