Open
Description
Is your feature request related to a problem? Please describe.
I often find myself writing code such as
Create.Table("FooType")
.WithColumn("Id").AsInt64().NotNullable().PrimaryKey()
.WithColumn("Name").AsString().NotNullable();
Insert.IntoTable("FooType").Row(new { Id = 1, Name = "TypeX" });
Insert.IntoTable("FooType").Row(new { Id = 2, Name = "TypeY" });
Insert.IntoTable("FooType").Row(new { Id = 3, Name = "TypeZ" });
alternatively, the data comes from some other API, and is some sort of array like collection:
foreach (var record in GetSomeRecordsFromSomewhere())
{
Insert.IntoTable("FooType").Row(record);
}
Describe the solution you'd like
How about some sort of Rows()
(note the plural in Method name) expression that takes an IEnumerable, so that one can write:
Insert.IntoTable("FooType").Rows(
[
new { Id = 1, Name = "TypeX" },
new { Id = 2, Name = "TypeY" },
new { Id = 3, Name = "TypeZ" }
]);
Insert.IntoTable("FooType").Rows(GetSomeRecordsFromSomewhere());
Additional context
N/A
Is this a feature you'd like to submit a PR for?
Yes
I guess I could have a go at this, under the hood it would probably simply iterate over the collection and delegate to Row()
.