sqlkata / querybuilder

SQL query builder, written in c#, helps you build complex queries easily, supports SqlServer, MySql, PostgreSql, Oracle, Sqlite and Firebird
https://sqlkata.com
MIT License
3.09k stars 499 forks source link

Insert many with IEnumerable<object> #665

Open Shepardeon opened 1 year ago

Shepardeon commented 1 year ago

Hi !

I noticed SqlKata was able to insert multiple records with one query by providing an IEnumerable<string> as columns IEnumerable<IEnumerable<object>> as values; which works great, however it feels a bit awkward to use. Especially since there is an implementation of AsInsert() that can take an object. So, I think it would make sense to have an overload of AsInsert() (and therefore of Insert() and InsertAsync()) which takes an IEnumerable<object> and compile the relevant query.

If you feel like this could be a nice addition to the library, I could try myself at a PR.

Cheers :)

JakeAlmer commented 1 year ago

I've thought the same thing!