Moq.Dapper icon indicating copy to clipboard operation
Moq.Dapper copied to clipboard

QueryAsync with multiple types does not work

Open ricochetbrown opened this issue 3 years ago • 0 comments

`var results = await connection.QueryAsync( "[dbo].[GetSomething]", types: new[] { typeof(Something), typeof(ASubThing), typeof(AnotherSubThing) }, map: objects => { var result = objects[0] as Something?? new Something();

                result.FirstSubThing= objects[1] as ASubThing?? new ASubThing();
                result.SecondSubThing= objects[2] as AnotherSubThing?? new AnotherSubThing();

                return result;
            },
            dbArgs,
            commandType: CommandType.StoredProcedure);`

moq.dapper continues to give an error saying that (When using the multi-mapping APIs ensure you set the splitOn param if you have keys other than Id (Parameter 'splitOn') even though the code works fine when the api is running.

ricochetbrown avatar Apr 14 '21 12:04 ricochetbrown