querybuilder icon indicating copy to clipboard operation
querybuilder copied to clipboard

AsInsert with IDictionary<string,object> throws NullReferenceException

Open brodrigz opened this issue 7 months ago • 0 comments

Passing an IDictionary<string,object> to .AsInsert() seems to result in an unhandled NullReferenceException SqlKata 2.4.0 SqlKata.Execution 2.4.0

Example:

            IDictionary<string, object> obj = new ExpandoObject();
            obj.Add("col1", "value");
            QueryFactory queryFactory = new();
            queryFactory.Query("tableName").AsInsert(new[] {obj}).Get(); //throws error

Call stack:

	SqlKata.Execution.dll!SqlKata.Execution.QueryFactory.CompileAndLog(SqlKata.Query query)	Unknown
 	SqlKata.Execution.dll!SqlKata.Execution.QueryFactory.Get<object>(SqlKata.Query query, System.Data.IDbTransaction transaction, int? timeout)	Unknown
 	SqlKata.Execution.dll!SqlKata.Execution.QueryExtensions.Get<object>(SqlKata.Query query, System.Data.IDbTransaction transaction, int? timeout)	Unknown
 	SqlKata.Execution.dll!SqlKata.Execution.QueryExtensions.Get(SqlKata.Query query, System.Data.IDbTransaction transaction, int? timeout)	Unknown

brodrigz avatar Jun 04 '25 17:06 brodrigz