ZZZ Projects retweeted
Replying to @zzzprojects
ZZZ Projects retweeted
Replying to @kristijan_kralj
I don't like SQLBulkCopy. So much code to write, especially when you need to insert related entities. And it's error-prone. And it doesn't work on other databases. I prefer cross-database libraries for bulk writes for EF Core, such as Entity Framework Extensions.
ZZZ Projects retweeted
With Dapper you run the application and it crashes because of a bug in SQL string
Here is how to fix it ๐
Dapper is fast and gives you full control over SQL.
But that control comes with a hidden cost.
Every INSERT, UPDATE, and DELETE you write lives inside a string.
And strings have zero type safety.
โณ Rename a column? No compile error.
โณ Change a property type? No compile error.
โณ Misspell a parameter name? No compile error.
You only find out something is broken when your app crashes at runtime.
Here is what most developers do when using Dapper:
โ Write SQL commands as plain strings
โ Map every parameter by hand
โ Repeat the same column lists across Insert, Update, and Delete
โ Hardcode table and schema names everywhere
One small refactor breaks half of your queries.
And the compiler will not save you.
There is a much better way.
In my latest video, I show how to solve this with ๐๐ฎ๐ฝ๐ฝ๐ฒ๐ฟ ๐ฃ๐น๐๐ ๐ ๐ฎ๐ฝ๐ฝ๐ถ๐ป๐ด.
Dapper Plus gives you 3 ways to map your entities to the database - all type-safe.
๐ญ. ๐๐๐๐ผ ๐ ๐ฎ๐ฝ๐ฝ๐ถ๐ป๐ด
โ Zero configuration needed
โ Library matches class name to table name
โ Properties match column names automatically
โ Just call SingleInsert or BulkInsert and it works
๐ฎ. ๐๐ฎ๐๐ฎ ๐๐ป๐ป๐ผ๐๐ฎ๐๐ถ๐ผ๐ป๐
โ Use [Table], [Column], [Key], [NotMapped] attributes
โ Familiar to anyone using EF Core
โ Keeps mapping next to your model
๐ฏ. ๐๐น๐๐ฒ๐ป๐ ๐๐ฃ๐ ๐ ๐ฎ๐ฝ๐ฝ๐ถ๐ป๐ด
โ Full control with strongly-typed lambdas
โ Map only what you need: .Map(x => new { x.Name, x.Price })
โ MapAuto method and DapperPlus figures it out for you
โ Refactor-friendly: rename a property and the compiler tells you
You can also organize mappings with ๐๐ฎ๐ฝ๐ฝ๐ฒ๐ฟ ๐ฃ๐น๐๐ ๐๐ผ๐ป๐๐ฒ๐
๐:
โ Global context - configure once at startup
โ Instance context - configure per use case
โ Inheritance context - reuse mappings across services
And the best part?
The same mapping works for ๐ฏ๐ผ๐๐ต free Single methods ๐ฎ๐ป๐ฑ paid Bulk methods.
No more SQL strings scattered across your codebase.
No more runtime surprises after a refactor.
Just clean, type-safe writes.
Watch the full video and see all 3 mapping approaches in action.
P.S.: You can get a free trial for this library and test for 30 days, and you can extend the trial for another month as needed.
Get started with Dapper Plus Mapping:
dapper-plus.net/mapping?utm_โฆ
Here is the source code:
github.com/anton-martyniuk/eโฆ
How do you solve runtime bugs in SQL strings when using Dapper? Share below ๐
โโ
โป๏ธ Repost to help others write type-safe Dapper queries
โ Follow me ( @anton-martyniuk ) to improve your .NET and Architecture Skills
Many thanks to @zzzprojects for sponsoring this post
ZZZ Projects retweeted
Replying to @AntonMartyniuk
Dapper plus is the best library for bulk operations, super fast and comprehensive. Teams can really benefit from it. Good value for its license. It is an investment for your product.
ZZZ Projects retweeted
๐ Important note:
You can use the following methods for free in Dapper Plus:
โ SingleInsert - insert one entity without writing SQL
โ SingleUpdate - update one entity
โ SingleDelete - delete one entity
โ SingleMerge - upsert in one line (insert or update)
โ SingleSynchronize - keep your data in sync with the source
โ CreateTable - create the table directly from your C# class
Get started with Dapper Plus:
dapper-plus.net/?utm_source=โฆ
ZZZ Projects retweeted
Dapper ๐ต๐ฎ๐ ๐ฎ ๐ฏ๐ถ๐ด ๐ฝ๐ฒ๐ฟ๐ณ๐ผ๐ฟ๐บ๐ฎ๐ป๐ฐ๐ฒ ๐ฝ๐ฒ๐ป๐ฎ๐น๐๐ ๐๐ต๐ฒ๐ป ๐๐ผ๐ insert multiple rows.
Here is how to address this problem ๐
Developers love Dapper for blazing-fast reads.
But for inserting or updating many rows, it becomes painfully slow (even slower than EF Core).
But Why?
Dapper sends each row to the database one by one.
10,000 rows = 10,000 round-trips.
And here is another problem:
โณ You need to write a lot of boilerplate code when using Dapper.
Here is what most developers do when using Dapper:
โ Write manual INSERT and UPDATE SQL statements
โ Build complex SQL with hundreds of parameters by hand
โ Write CREATE TABLE scripts
And the problem is that you don't have type safety when writing SQL commands inside strings. When something goes wrong you will only know at runtime.
There is a much better way.
In my latest video, I show how to solve this with ๐๐ฎ๐ฝ๐ฝ๐ฒ๐ฟ ๐ฃ๐น๐๐.
๐ ๐ฆ๐๐ผ๐ฝ ๐ช๐ฟ๐ถ๐๐ถ๐ป๐ด ๐๐ผ๐บ๐ฝ๐น๐ฒ๐
๐ฆ๐ค๐ ๐๐ผ ๐ฆ๐ฎ๐๐ฒ ๐๐ฎ๐๐ฎ - ๐๐ฒ๐ ๐๐ฎ๐ฝ๐ฝ๐ฒ๐ฟ ๐ฃ๐น๐๐ ๐๐ผ ๐๐ ๐ณ๐ผ๐ฟ ๐ฌ๐ผ๐.
Dapper Plus gives you clean, simple methods for every write operation.
๐๐ฟ๐ฒ๐ฒ ๐ฆ๐ถ๐ป๐ด๐น๐ฒ ๐ ๐ฒ๐๐ต๐ผ๐ฑ๐:
โ SingleInsert - insert one entity without writing SQL
โ SingleUpdate - update one entity
โ SingleDelete - delete one entity
โ SingleMerge - upsert in one line (insert or update)
โ SingleSynchronize - keep your data in sync with the source
โ CreateTable - create the table directly from your C# class
No more manual SQL.
No more parameter mapping by hand.
Just call the method and Dapper Plus handles the rest.
All single methods are ๐ณ๐ฟ๐ฒ๐ฒ ๐๐ผ ๐๐๐ฒ.
๐ฃ๐ฎ๐ถ๐ฑ ๐๐๐น๐ธ ๐ ๐ฒ๐๐ต๐ผ๐ฑ๐ (for high performance):
โ BulkInsert
โ BulkUpdate
โ BulkDelete
โ BulkMerge
โ BulkSynchronize
This is where the real magic happens.
I inserted 10,000 product records into the database:
โ Dapper: 7,000 ms
โ
Dapper Plus BulkInsert: 300 ms
That is over ๐ต๐ฒ% ๐ณ๐ฎ๐๐๐ฒ๐ฟ with a single line of code.
Dapper Plus supports SQL Server, PostgreSQL, MySQL, Oracle, MariaDB, and SQLite.
Watch the full video and see every method in action.
P.S.: You can get a free trial for this library and test for 30 days, and you can extend the trial for another month as needed.
Get started with Dapper Plus:
dapper-plus.net?utm_source=aโฆ
Here is the source code:
github.com/anton-martyniuk/eโฆ
How do you currently handle bulk inserts in Dapper? Share below ๐
โโ
โป๏ธ Repost to help others speed up their Dapper write queries
โ Follow me ( @AntonMartyniuk ) to improve your .NET and Architecture Skills
Many thanks to @zzzprojects for sponsoring this post
๐ค Paid partnership
ZZZ Projects retweeted
๐ฌ๐ผ๐ ๐๐๐ถ๐น๐น ๐๐ฟ๐ถ๐๐ฒ ๐ฎ ๐ช๐ต๐ฒ๐ฟ๐ฒ + ๐๐ผ๐ป๐๐ฎ๐ถ๐ป๐ ๐ถ๐ป ๐๐ ๐๐ผ๐ฟ๐ฒ?
Please stop! ๐
As you are ruining the performance of your application.
When working with Entity Framework Core, developers often need to retrieve multiple entities from the database based on a collection of IDs or values.
The typical approach is to use the Contains method:
๐๐๐ ๐๐๐๐๐๐๐๐ = ๐๐ ๐๐๐ ๐๐๐ฒ๐๐๐๐๐ก๐.๐ฟ๐๐๐๐๐๐๐
.๐๐๐๐๐(๐ => ๐๐๐๐๐๐๐๐ธ๐๐.๐ฒ๐๐๐๐๐๐๐(๐.๐ธ๐))
.๐๐๐ป๐๐๐๐ฐ๐๐ข๐๐();
This approach works fine for small collections, but it creates significant problems when dealing with large datasets:
โ Performance degradation - Even with proper indexes, the SQL WHERE IN clause becomes slower as the number of parameters increases.
โ Parameter limit exceeded - SQL Server has a hard limit of 2,100 parameters per query. While you can work around this by splitting queries into batches in SQL, this is not always practical when using EF Core, especially in complex scenarios with additional filters and joins.
โ Memory and connection issues - Multiple round-trips to the database consume more memory and keep database connections open longer, potentially causing connection pool exhaustion.
This becomes a real problem in scenarios like synchronizing product catalogs, processing bulk orders, or updating inventory across thousands of items.
There is a better solution: ๐๐ป๐๐ถ๐๐ ๐๐ฟ๐ฎ๐บ๐ฒ๐๐ผ๐ฟ๐ธ ๐๐
๐๐ฒ๐ป๐๐ถ๐ผ๐ป๐ library provides specialized methods for bulk data retrieval that solve all these problems.
The library provides specialized methods that use temporary tables internally to bypass the parameter limit and improve performance.
In the video, I show a detailed guide to 5 bulk-read methods using the ๐๐ป๐๐ถ๐๐ ๐๐ฟ๐ฎ๐บ๐ฒ๐๐ผ๐ฟ๐ธ ๐๐
๐๐ฒ๐ป๐๐ถ๐ผ๐ป๐ library.
I explain in depth these methods:
โ WhereBulkContains
โ WhereBulkNotContains
โ BulkRead
โ WhereBulkContainsFilterList
โ WhereBulkNotContainsFilterList
๐ Get the source code of this video:
โณ github.com/anton-martyniuk/eโฆ
๐ Get started with EF Core Extensions:
โณ entityframework-extensions.nโฆ
โโ
โป๏ธ Repost to help others learn how to perform bulk read operations in EF Core
โ Follow me ( @AntonMartyniuk ) to improve your .NET and Architecture Skills
Many thanks to @zzzprojects for sponsoring this post.
ZZZ Projects retweeted
These options in Entity Framework Extensions library (PART 2)
Will save you hours, days or even weeks of development ๐
Entity Framework Extensions library is not only useful when you need to insert thousands of records.
It also comes with hundreds of useful options that can save a lot of time in your daily routine with EF Core.
In the video, I show a detailed guide on various options with ๐๐ป๐๐ถ๐๐ ๐๐ฟ๐ฎ๐บ๐ฒ๐๐ผ๐ฟ๐ธ ๐๐
๐๐ฒ๐ป๐๐ถ๐ผ๐ป๐ library.
This video is PART 2 in the series.
You can try EF Core Extensions for free with the monthly trial.
๐ Get started with EF Core Extensions:
โณ lnkd.in/djZVdbPY
๐ See real-world benchmarks:
โณ lnkd.in/eMD9dAvt
๐ Get the source code of this video:
โณ lnkd.in/dkp4XaXG
โโ
โป๏ธ Repost to help others save time with EF Core Extensions
โ Follow me ( @AntonMartyniuk ) to improve your .NET and Architecture Skills
Many thanks to @zzzprojects for sponsoring this post.
ZZZ Projects retweeted
These options in Entity Framework Extensions library
Will save you hours, days or even weeks of development ๐
Entity Framework Extensions library is not only useful when you need to insert thousands of records.
It also comes with hundreds of useful options that can save a lot of time in your daily routine with EF Core.
In the video, I show a detailed guide on various options with ๐๐ป๐๐ถ๐๐ ๐๐ฟ๐ฎ๐บ๐ฒ๐๐ผ๐ฟ๐ธ ๐๐
๐๐ฒ๐ป๐๐ถ๐ผ๐ป๐ library.
This is the first part of the video, stay tuned for more PART 2 in 2 weeks.
You can try EF Core Extensions for free with the monthly trial.
๐ Get started with EF Core Extensions:
โณ entityframework-extensions.nโฆ
๐ See real-world benchmarks:
โณ github.com/zzzprojects/Entitโฆ
๐ Get the source code of this video:
โณ github.com/anton-martyniuk/eโฆ
โโ
โป๏ธ Repost to help others save time with EF Core Extensions
โ Follow me ( @AntonMartyniuk ) to improve your .NET and Architecture Skills
Many thanks to @zzzprojects for sponsoring this post.
ZZZ Projects retweeted
๐ง๐ต๐ฒ ๐๐ผ๐บ๐ฝ๐น๐ฒ๐๐ฒ ๐๐๐ถ๐ฑ๐ฒ ๐๐ผ ๐๐๐น๐ธ ๐ข๐ฝ๐ฒ๐ฟ๐ฎ๐๐ถ๐ผ๐ป๐ ๐๐ถ๐๐ต ๐๐ป๐๐ถ๐๐ ๐๐ฟ๐ฎ๐บ๐ฒ๐๐ผ๐ฟ๐ธ ๐๐
๐๐ฒ๐ป๐๐ถ๐ผ๐ป๐
This library was one of the best investments for me
Do you know why SaveChanges method in DbContext is slow when you insert a large number of entities?
In many databases, EF Core batches multiple inserts into a single command. But the database still executes these inserts one by one.
For SQL Server - EF Core uses a MERGE statement to insert multiple rows at once.
However, EF Core's approach is limited by the number of SQL parameters (2,100 per batch). Performance drops quickly when entities have many columns.
In the video, I show a detailed guide on bulk write operations with ๐๐ป๐๐ถ๐๐ ๐๐ฟ๐ฎ๐บ๐ฒ๐๐ผ๐ฟ๐ธ ๐๐
๐๐ฒ๐ป๐๐ถ๐ผ๐ป๐ library.
I explore in depth the following methods:
- BulkInsert
- BulkInsertOptimized
- BulkUpdate
- BulkDelete
- BulkMerge
- BulkSynchronize
- BulkSaveChanges
And as well as their various options.
This NuGet package is easy to add to an existing project:
- Add the package
- One line of code to perform blazing-fast bulk write operations
EF Core Extensions:
๐ Works with SQL Server, Postgres, MySQL, Oracle, MariaDB, SQLite.
๐ Supports EF Core 2 โ 9, all inheritance types, and complex entities.
This is a paid library, but the investment in it - pays off quickly through improved performance, reduced development time, and simplified maintenance.
You can try EF Core Extensions for free with the monthly trial.
๐ Get started with EF Core Extensions:
โณ entityframework-extensions.nโฆ
๐ See real-world benchmarks:
github.com/zzzprojects/Entitโฆ
๐ Get the source code:
github.com/anton-martyniuk/eโฆ
โโ
โป๏ธ Repost to help others learn about EF Core Extensions library
โ Follow me ( @AntonMartyniuk ) to improve your .NET and Architecture Skills
Many thanks to ZZZ Projects for sponsoring this post.
ZZZ Projects retweeted
๐ช๐ต๐ ๐๐๐ฒ๐ฟ๐ ๐๐ ๐๐ผ๐ฟ๐ฒ ๐๐ฒ๐๐ฒ๐น๐ผ๐ฝ๐ฒ๐ฟ ๐ก๐ฒ๐ฒ๐ฑ๐ ๐๐ผ ๐ง๐ฟ๐ ๐๐ป๐๐ถ๐๐ ๐๐ฟ๐ฎ๐บ๐ฒ๐๐ผ๐ฟ๐ธ ๐๐
๐๐ฒ๐ป๐๐ถ๐ผ๐ป๐
SaveChanges method in DbContext slows you down ๐
๐ EF Core batches inserts depending on the provider, but itโs still not a true bulk insert โ and entity tracking adds extra memory overhead.
This becomes even more noticeable as the number of rows grows into the thousands or millions.
In the video, I show how I solve this problem with ๐๐ป๐๐ถ๐๐ ๐๐ฟ๐ฎ๐บ๐ฒ๐๐ผ๐ฟ๐ธ ๐๐
๐๐ฒ๐ป๐๐ถ๐ผ๐ป๐ library.
This NuGet package is easy to add to an existing project:
- Add the package
- One line of code to perform blazing-fast bulk inserts
- No extra configuration required
In my tests with SQL Server:
โข SaveChanges took ~2,000 ms
โข BulkInsert took ~200 ms
โข BulkInsertOptimized took only โก130 ms
EF Core Extensions supports the following bulk write operations:
1๏ธโฃ BulkUpdate โ update 1000s of records at once
2๏ธโฃ BulkDelete โ delete large datasets fast
3๏ธโฃ BulkMerge โ upsert (insert or update) in one step
4๏ธโฃ BulkSynchronize โ keep your data in sync automatically
5๏ธโฃ FutureAction โ queue multiple bulk operations and run them later
Bulk operations also work with child entities.
EF Core Extensions:
๐ Works with SQL Server, Postgres, MySQL, Oracle, MariaDB, SQLite.
๐ Supports EF Core 2 โ 9, all inheritance types, and complex entities.
If you're working with large datasets, this library is a game changer.
You'll insert, update, and delete thousands of rows 10-15x times faster than using regular SaveChanges.
And the best part? You can try it for free with the monthly trial.
๐ Get started with EF Core Extensions:
โณ entityframework-extensions.nโฆ
๐ See real-world benchmarks:
github.com/zzzprojects/Entitโฆ
๐ Get the source code:
github.com/anton-martyniuk/eโฆ
โโ
โป๏ธ Repost to help others learn about EF Core Extensions library
โ Follow me ( @AntonMartyniuk ) to improve your .NET Skills
Many thanks to ZZZ Projects for sponsoring this post.
ZZZ Projects retweeted
SQL Fiddle has launched a new version for 2024: sqlfiddle.com/ ๐
Now featuring enhanced stability, a sleek design, and an AI Chat feature! Give it a try.
More changes coming soon.
#AI #SQLFiddle #SQL #SQLServer #MySQL #PostgreSQL
ZZZ Projects retweeted
Wait, what?
#Dapper and #EntityFramework #EFCore together?
That's right. In just over 1 hour we are excited to welcome @Nick_Craver and @marcgravell to talk all things Dapper and answers your questions live.
Check out the live stream on YouTube here:
youtu.be/txiQar6PqvA
ZZZ Projects retweeted
The Azure Daily is out! paper.li/rgonv/1320180926?edโฆ Stories via @zzzprojects @jajordan13 @alan_beattie
ZZZ Projects retweeted
SQL Server Daily News is out! paper.li/SpartanIT/131620341โฆ Stories via @EdwinMSarmiento @Live360events @zzzprojects







