Loading chat...
IL HB1715
Bill
Status
8/1/2025
Primary Sponsor
Lisa Davis
Click for details
AI Summary
-
Repeals Section 510-200 of the Department of Children and Family Services Powers Law within the Civil Administrative Code of Illinois
-
Eliminates provisions related to DCFS police or security functions
-
Takes effect immediately upon becoming law
chattuna avatar Jun 11 '25 18:06 chattunaEnd PageDapper Dapper copied to clipboard Issue with Multi-mapping and Table-Valued Parameters In what appears to be a bug, when combining multi-mapping and table valued parameters, Dapper seems to mix up the results. I have an ID table type CREATE TYPE [dbo].[IdTableType] AS TABLE ( [Id] INT NULL ) A stored proc with a TVP input CREATE PROCEDURE [dbo].[GetBooksAndAuthorsForIds] @ids dbo.IdTableType READONLY AS SELECT * FROM (VALUES (1, 'Book1', 'Author1'), (2, 'Book2', 'Author2'), (3, 'Book3', 'Author3'), (4, 'Book4', 'Author4'), (5, 'Book5', 'Author5'), (6, 'Book6', 'Author6')) AS Book (Id, Name, Author) JOIN @ids AS BookIds ON Book.Id = BookIds.Id RETURN 0 This query returns the expected result in SSMS: DECLARE @Ids dbo.IdTableType INSERT INTO @Ids VALUES (1), (2), (3) EXEC dbo.GetBooksAndAuthorsForIds @ids = @Ids Id | Name | Author | Id | ---|---|---|---| 1 | Book1 | Author1 | 1 | 2 | Book2 | Author2 | 2 | 3 | Book3 | Author3 | 3 | public class Book { public int Id { get; set; } public string Name { get; set; } } public class Author { public int Id { get; set; } public string Name { get; set; } } Calling the stored procedure from Dapper without multi-mapping works: // No multi-mapping, result: 3 books: ("Book1", "Book2", "Book3") var books = await connection.QueryAsync<Book>("[dbo].[GetBooksAndAuthorsForIds]", new { ids = ids.AsTableValuedParameter("dbo.IdTableType") }, commandType: CommandType.StoredProcedure); But calling with multi-mapping mixes up books in the result: // With multi-mapping result: 3 books: ("Book1", "Book3", "Book4") var booksWithAuthors = await connection.QueryAsync<Book, Author, Book>("[dbo].[GetBooksAndAuthorsForIds]", (book, author) => book, new { ids = ids.AsTableValuedParameter("dbo.IdTableType") }, splitOn: "Author", commandType: CommandType.StoredProcedure); Expected result: Book1, Book2, Book3 Actual result: Book1, Book3, Book4 Please see the gist with the full repro code https://gist.github.com/llenroc/9b0c71cdf4f39cbdce6aa44a9df8f36f @llenroc I think you just need to change split on from Author to Id , with that first Id being the second one in the result set. Or just use a different alias in the select. To explain: we're splitting on the results, looking for a column named Author . But that column doesn't exist. So the split point is left as the default: Id . But there's the first result of Id which is what's splitting, and that results in an inconsistent (there are 2 columns in each object) parse across result rows where results can vary. @NickCraver Thanks. This is what I thought too. Tried changing the SplitOn to Id and unfortunately it gives the same incorrect results. Same with adding a second Id in the split. Can you please double check that? var booksWithAuthors = await connection.QueryAsync<Book, Author, Book>("[dbo].[GetBooksAndAuthorsForIds]", (book, author) => book, new { ids = ids.AsTableValuedParameter("dbo.IdTableType
Legislative Description
DCFS-POLICE/SECURITY-REPEAL
Last Action
Public Act . . . . . . . . . 104-0052
8/1/2025