Skip to content

Commit 6568507

Browse files
author
fabien.menager
committed
Add initial project files including CODEOWNERS, CONTRIBUTING guidelines, LICENSE, and README
1 parent bd4801a commit 6568507

8 files changed

Lines changed: 120 additions & 0 deletions

CODEOWNERS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# See https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
2+
# This file designates code owners for this repository.
3+
# Each line is a file pattern followed by one or more owners.
4+
5+
* @phenx
6+

CONTRIBUTING.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Contributing to Project Guidelines
2+
3+
### No guidelines here :D, hit us with your PR.
4+
**Working on your first Pull Request?** You can learn how from this *free* series [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github)

EntityFrameworkCore.ExecuteInsert.sln

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EntityFrameworkCore.Execute
1919
EndProject
2020
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EntityFrameworkCore.ExecuteInsert.Sqlite", "src\EntityFrameworkCore.ExecuteInsert.Sqlite\EntityFrameworkCore.ExecuteInsert.Sqlite.csproj", "{450E859C-411F-4D67-A0B4-4E02C3D30E14}"
2121
EndProject
22+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "root", "root", "{45366E91-4386-4DAC-9D09-226902EA6D9F}"
23+
ProjectSection(SolutionItems) = preProject
24+
.editorconfig = .editorconfig
25+
.gitignore = .gitignore
26+
LICENSE = LICENSE
27+
README.md = README.md
28+
EndProjectSection
29+
EndProject
2230
Global
2331
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2432
Debug|Any CPU = Debug|Any CPU

LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
MIT License
2+
3+
Copyright (c) 2025 phenx
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+

README.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# EntityFrameworkCore.ExecuteInsert
2+
3+
A high-performance, provider-agnostic bulk insert extension for Entity Framework Core. Supports SQL Server, PostgreSQL, SQLite.
4+
5+
## Features
6+
- Very fast bulk insert support for multiple database providers
7+
- Supports SQL Server, PostgreSQL, and SQLite
8+
- Simple and intuitive API
9+
- Benchmarking and test projects included
10+
11+
## Installation
12+
13+
Install the NuGet package for your database provider:
14+
15+
```shell
16+
# For SQL Server
17+
Install-Package EntityFrameworkCore.ExecuteInsert.SqlServer
18+
19+
# For PostgreSQL
20+
Install-Package EntityFrameworkCore.ExecuteInsert.PostgreSql
21+
22+
# For SQLite
23+
Install-Package EntityFrameworkCore.ExecuteInsert.Sqlite
24+
```
25+
26+
## Usage
27+
28+
1. Register the bulk insert provider in your `DbContextOptions`:
29+
30+
```csharp
31+
services.AddDbContext<MyDbContext>(options =>
32+
{
33+
options
34+
.UseSqlServer(connectionString) // or UseNpgsql or UseSqlite, as appropriate
35+
.UseBulkInsert(); // <<< The important part
36+
});
37+
```
38+
39+
2. Use the bulk insert extension method:
40+
41+
```csharp
42+
await dbContext.ExecuteInsertAsync(entities);
43+
```
44+
45+
3. Optionally, you can configure the bulk insert options:
46+
47+
```csharp
48+
await dbContext.ExecuteInsertAsync(entities, options =>
49+
{
50+
options.BatchSize = 1000; // Set the batch size for the insert operation, the default value is different for each provider
51+
});
52+
```
53+
54+
4. You can also return the inserted entities (slower):
55+
56+
```csharp
57+
await dbContext.ExecuteInsertWithIdentityAsync(entities, options => {});
58+
```
59+
60+
## Benchmarks
61+
Benchmark projects are available in the [`tests/EntityFrameworkCore.ExecuteInsert.Benchmark`](tests/EntityFrameworkCore.ExecuteInsert.Benchmark/LibComparator.cs) directory.
62+
Run them to compare performance with other libraries (https://github.com/videokojot/EFCore.BulkExtensions.MIT and https://entityframework-extensions.net/bulk-extensions),
63+
using optimized configuration (local Docker is required).
64+
65+
There is no need to compare with basic EF Core SaveChangesAsync, as it is significantly slower.
66+
67+
SQL Server results :
68+
![bench-sqlserver.png](images/bench-sqlserver.png)
69+
70+
PostgreSQL results :
71+
![bench-postgresql.png](images/bench-postgresql.png)
72+
73+
SQLite results :
74+
![bench-sqlite.png](images/bench-sqlite.png)
75+
76+
## Contributing
77+
Contributions are welcome! Please open issues or submit pull requests for bug fixes, features, or documentation improvements.
78+
79+
## License
80+
MIT License. See [LICENSE](LICENSE) for details.

images/bench-postgresql.png

34.1 KB
Loading

images/bench-sqlite.png

34.5 KB
Loading

images/bench-sqlserver.png

35.3 KB
Loading

0 commit comments

Comments
 (0)