querybuilder
querybuilder copied to clipboard
InsertGetId<T>() throws TargetParameterCountException
With SqliteCompiler
,
when calling:
int insertedRowId = queryFactory.Query(TableName).InsertGetId<int>(data);
with data
being a:
Dictionary<string, object>
a System.Reflection.TargetParameterCountException
is thrown on:
function:
private Dictionary<string, object> BuildDictionaryFromObject(object data, bool considerKeys = false)
(Query.cs, line 369)
Thanks in advance for your help.
is it related to #331 ? I think this problem has been solved and now is in nightly builds. -Edit: I have tried the latest Nightly build and the problem still exists.
@matteoiurato @hussamelvani I tried the latest version 2.2.0 and everything is working as expected could you confirm please?.
I've tried this on 2.2.0 and am getting this error too. Same conditions. The property it's failing on is System.Collections.Generic.IDictionary<System.String,System.Object>.Item
I'm passing in the ExpandoObject in my case, however, expando implements IDictionary, so also same scenario.
An IDictionary<string, object>
should be cast to IReadOnlyDictionary<string, object>
in order to make use of the appropriate overload. Otherwise, the overload that accepts an object is used, which tries (and fails) to use the reflection to enumerate the data columns.