Drizin / Drizin/InterpolatedSql

Are Bulkoperations possible?

Open
#20 0 comments 0 reactions 0 assignees View on GitHub
help wanted question
Dominant language
C#
Stars
279
Forks
15
PR merge metrics
No merged PRs in 30d

Description

Hey, first i want to point out that i love the idea of this library and i recently discovered it. I have a question about bulk operations. Is there a chance to do bulk operations for example inserts?

Before i discovered this library i would have done it like below. I love the idea of doing just the formattable string thing and would like to adapt that also for the buk operations.

```c#
public async Task> CreateBulkAsync(IReadOnlyCollection entities,
CancellationToken cancellationToken = default)
{
var parameters = entities.Select(entity => new
{
name = entity.Name,
descriptioN = entity.Description
});

CommandDefinition definition = new ("""
INSERT INTO roles (name, description)
VALUES (@name, @description)
""", parameters);
await Connection.ExecuteAsync(definition);

return new Success();
}
```

If possible please point me to a example.
Thank you

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.