I have seen here
How to insert an IEnumerable<T> collection with dapper-dot-net
how dapper is able to handle IEnumerable
as an input param and dispatch multiple commands for each member of the collection.
In my case I have an IEnumerable<int> Categories
and a int SurveyId
and I want to insert this one-to-many relationship into a separate mapping table called SurveyCategories
Is there a LINQ extension that I could use to concatenate these Categories with the same SurveyId
, similar to .Concat()
?
Or should I loop through the collection and build up a new list of objects with SurveyId and CategoryId properties?