### Install Z.EntityFramework.Extensions Source: https://entityframework-extensions.net/ef-profiler Install Z.EntityFramework.Extensions using the Package Manager Console. ```powershell PM> Install-Package Z.EntityFramework.Extensions ``` -------------------------------- ### Install EFE Core Source: https://entityframework-extensions.net/efcore-inmemory-provider Command to install the Z.EntityFramework.Extensions.EFCore NuGet package. ```powershell PM> Install-Package Z.EntityFramework.Extensions.EFCore ``` -------------------------------- ### Install Pomelo.EntityFrameworkCore.MySql Source: https://entityframework-extensions.net/efcore-pomelo-mysql-provider Command to install the Pomelo.EntityFrameworkCore.MySql NuGet package. ```powershell PM> Install-Package Pomelo.EntityFrameworkCore.MySql ``` -------------------------------- ### Install SQL Server Provider Source: https://entityframework-extensions.net/efcore-sql-server-provider Command to install the Microsoft.EntityFrameworkCore.SqlServer package. ```powershell PM> Install-Package Microsoft.EntityFrameworkCore.SqlServer ``` -------------------------------- ### Install EntityFramework.SqlServerCompact Source: https://entityframework-extensions.net/sql-server-compact-provider Command to install the EntityFramework.SqlServerCompact NuGet package. ```powershell PM> Install-Package EntityFramework.SqlServerCompact ``` -------------------------------- ### Default Constructor Example Source: https://entityframework-extensions.net/context-factory An example of a DbContext class with a default constructor. ```csharp public class EntitiesContext : DbContext { public EntitiesContext() : base("CodeFirstEntities") { // I'm a default constructor! } // ...code... } ``` -------------------------------- ### Install Glimpse Packages Source: https://entityframework-extensions.net/glimpse Install Glimpse MVC5 and Glimpse EF6 packages using the Package Manager Console. ```powershell PM> Install-Package Glimpse.MVC5 PM> Install-Package Glimpse.EF6 ``` -------------------------------- ### Install EFE Core Source: https://entityframework-extensions.net/efcore-sql-server-provider Command to install Z.EntityFramework.Extensions.EFCore using the Package Manager Console. ```powershell PM> Install-Package Z.EntityFramework.Extensions.EFCore ``` -------------------------------- ### Install MySql.Data.Entity Source: https://entityframework-extensions.net/mysql-provider Command to install the MySql.Data.Entity NuGet package. ```powershell PM> Install-Package MySql.Data.Entity ``` -------------------------------- ### Install System.Data.SQLite Source: https://entityframework-extensions.net/sqlite-provider Command to install the System.Data.SQLite NuGet package. ```powershell PM> Install-Package System.Data.SQLite ``` -------------------------------- ### Install Entity Framework Profiler Source: https://entityframework-extensions.net/efcore-profiler Command to install the Entity Framework Profiler NuGet package. ```powershell PM> Install-Package EntityFrameworkProfiler ``` -------------------------------- ### Bulk Insert and Data Retrieval Example Source: https://entityframework-extensions.net/effort-provider An example demonstrating the creation of a transient connection, setting the context factory, bulk inserting author and book records, and then retrieving them. ```csharp DbConnection connection = Effort.DbConnectionFactory.CreateTransient(); Z.EntityFramework.Extensions.EntityFrameworkManager.ContextFactory = context => new EntityContext(connection); using (var context = new EntityContext(connection)) { context.Database.CreateIfNotExists(); var authors = new List { new Author { FirstName = "Carson", LastName = "Alexander", BirthDate = DateTime.Parse("1985-09-01"), Books = new List() { new Book { Title = "Introduction to Machine Learning"}, new Book { Title = "Advanced Topics in Machine Learning"}, new Book { Title = "Introduction to Computing"} } }, new Author { FirstName = "Meredith", LastName = "Alonso", BirthDate = DateTime.Parse("1970-09-01"), Books = new List() { new Book { Title = "Introduction to Microeconomics"} } }, new Author { FirstName = "Arturo", LastName = "Anand", BirthDate = DateTime.Parse("1963-09-01"), Books = new List() { new Book { Title = "Calculus I"}, new Book { Title = "Calculus II"} } } }; context.BulkInsert(authors, options => options.IncludeGraph = true); } using (var context = new EntityContext()) { var list = context.Authors .Include(a => a.Books) .ToList(); foreach (var author in list) { Console.WriteLine(author.FirstName + " " + author.LastName); foreach (var book in author.Books) { Console.WriteLine("\t" + book.Title); } } } ``` -------------------------------- ### Install Oracle.EntityFrameworkCore Source: https://entityframework-extensions.net/efcore-oracle-provider Command to install the Oracle.EntityFrameworkCore NuGet package using the Package Manager Console. ```powershell PM> Install-Package Oracle.EntityFrameworkCore ``` -------------------------------- ### Install EntityFramework6.Npgsql Source: https://entityframework-extensions.net/postgresql-provider Command to install the EntityFramework6.Npgsql NuGet package using the Package Manager Console. ```powershell PM> Install-Package EntityFramework6.Npgsql ``` -------------------------------- ### Benchmark Example Source: https://entityframework-extensions.net/benchmark An example demonstrating how to properly benchmark Entity Framework Extensions methods by first JIT compiling the library and then including only the method under test. ```csharp public Benchmark() { // BENCHMARK using Stopwatch var clock1 = new Stopwatch(); var clock2 = new Stopwatch(); var nbRecord = 1000; var nbTry = 5; var list = GenerateData(nbRecord); // BENCHMARK: JIT compile library first Test1(list, new Stopwatch()); Test2(list, new Stopwatch()); for (var i = 0; i < nbTry; i++) { Test1(list, clock1); Test2(list, clock2); } var r1 = clock1.ElapsedMilliseconds/nbTry; var r2 = clock2.ElapsedMilliseconds/nbTry; } public void Test1(List lines, Stopwatch clock) { using (var ctx = new CustomerContext()) { var customers = new List(); foreach (var line in lines) { var customer = new Customer(); // ...code... customers.Add(customer); } ctx.Customers.AddRange(customers); // BENCHMARK: Only method we want to test clock.Start(); ctx.BulkSaveChanges(); clock.Stop(); } } public void Test2(List lines, Stopwatch clock) { using (var ctx = new CustomerContext()) { var customers = new List(); foreach (var line in lines) { var customer = new Customer(); // ...code... customers.Add(customer); } ctx.Customers.AddRange(customers); // BENCHMARK: Only method we want to test clock.Start(); ctx.SaveChanges(); clock.Stop(); } } public List GenerateData(int nbRecord) { var list = new List(); for (var i = 0; i < nbRecord; i++) { list.Add(i.ToString()); } return list; } ``` -------------------------------- ### EF BulkDelete Example Source: https://entityframework-extensions.net/fastest-way-to-insert Provides examples of using the BulkDelete method for removing multiple records, including options for custom keys. ```csharp ctx.BulkDelete(list); ctx.BulkDelete(list, options => { options.ColumnPrimaryKeyExpression = x => new { x.Code }; options.AllowConcurrency = false; }); ``` -------------------------------- ### Install Entity Framework Core Tools Source: https://entityframework-extensions.net/efcore-devart-mysql-provider Commands to install the necessary Entity Framework Core packages for creating migrations. ```powershell PM> Install-Package Microsoft.EntityFrameworkCore.Tools PM> Install-Package Microsoft.EntityFrameworkCore.Design ``` -------------------------------- ### Bulk Insert Example Source: https://entityframework-extensions.net/bulk-extensions Example of how to bulk insert a list of entities along with their related entities using the IncludeGraph option. ```csharp // @nuget: Z.EntityFramework.Extensions.EFCore using Z.EntityFramework.Extensions; context.BulkInsert(invoices, options => { options.IncludeGraph = true; }); ``` -------------------------------- ### PostConfiguration Event Example Source: https://entityframework-extensions.net/events This example demonstrates using the `PostConfiguration` event to set a custom `FormulaInsert` on the `Description` column right before a bulk method executes. ```csharp // @nuget: Z.EntityFramework.Extensions.EFCore using Z.EntityFramework.Extensions; context.BulkInsert(list, options => { options.PostConfiguration = ops => { ops.ColumnMappings .Find(x => x.SourceName == "Description") .FormulaInsert = "'any valid sql statement'"; }; }); ``` -------------------------------- ### Setup Menu Options Source: https://entityframework-extensions.net/glimpse Add menu entries for Authors to the navigation bar. ```html @ViewBag.Title - My ASP.NET Application @Styles.Render("~/Content/css") @Scripts.Render("~/bundles/modernizr")
@RenderBody()

© @DateTime.Now.Year - My ASP.NET Application

@Scripts.Render("~/bundles/jquery") @Scripts.Render("~/bundles/bootstrap") @RenderSection("scripts", required: false) ``` -------------------------------- ### Configuring Options Using an Instance Source: https://entityframework-extensions.net/configure-options Shows how to configure options using a reusable options instance to avoid duplication. ```csharp // @nuget: Z.EntityFramework.Extensions.EFCore using Z.EntityFramework.Extensions; var customerOptions = context.Customers.CreateBulkOptions(); // or var customerOptions = context.CreateBulkOptions(); customerOptions.BatchSize = 1000; customerOptions.BatchTimeout = 60; customerOptions.ColumnPrimaryKeyExpression = x => x.ID; context.BulkInsert(list, customerOptions); ``` -------------------------------- ### Batch Operations Examples Source: https://entityframework-extensions.net/overview Demonstrates how to use InsertFromQuery, UpdateFromQuery, and DeleteFromQuery for efficient data manipulation directly in the database. ```csharp // @nuget: Z.EntityFramework.Extensions.EFCore using Z.EntityFramework.Extensions; // INSERT all customers inactive for more than two years into a backup table var date = DateTime.Now.AddYears(-2); context.Customers .Where(x => x.IsActive && x.LastLogin < date) .InsertFromQuery("bck_Customer", x => new { x.CustomerID, x.Name, x.Email }); // UPDATE all customers inactive for more than two years context.Customers .Where(x => x.IsActive && x.LastLogin < DateTime.Now.AddYears(-2)) .UpdateFromQuery(x => new Customer { IsActive = false }); // DELETE all customers inactive for more than two years context.Customers .Where(x => x.LastLogin < DateTime.Now.AddYears(-2)) .DeleteFromQuery(); ``` -------------------------------- ### BulkMerge Example Source: https://entityframework-extensions.net/fastest-way-to-insert Demonstrates how to use the BulkMerge operation with various configuration options. ```csharp ctx.BulkMerge(list); ctx.BulkMerge(list, options => { options.ColumnInputExpression = x => new { x.Code, x.CreatedDate, x.UpdatedDate }; options.IgnoreOnMergeInsertExpression = x => new { x.UpdatedDate }; options.IgnoreOnMergeUpdateExpression = x => new { x.ID, x.CreatedDate }; options.ColumnPrimaryKeyExpression = x => new { x.Code }; options.AutoMapOutputDirection = false; options.MergeKeepIdentity = true; }); ``` -------------------------------- ### Single-line Expression vs Code Block Source: https://entityframework-extensions.net/configure-options Demonstrates configuring options using both single-line expressions and code blocks for bulk operations. ```csharp // @nuget: Z.EntityFramework.Extensions.EFCore using Z.EntityFramework.Extensions; // Single-line expression context.BulkInsert(list, options => options.BatchSize = 1000); // Code block context.BulkInsert(list, options => { options.BatchSize = 1000; options.BatchTimeout = 60; }); ``` -------------------------------- ### Install Effort Source: https://entityframework-extensions.net/effort-provider Install the Effort.EF6 NuGet package using the Package Manager Console. ```powershell PM> Install-Package Effort.EF6 ``` -------------------------------- ### Setup Database Connection String Source: https://entityframework-extensions.net/mysql-provider Configures the connection string for the BookStoreContext in the App.config file. ```xml ``` -------------------------------- ### Install Entity Framework Profiler Source: https://entityframework-extensions.net/ef-profiler Install the Entity Framework Profiler into your application from NuGet. ```powershell PM> Install-Package EntityFrameworkProfiler ``` -------------------------------- ### Install Oracle.ManagedDataAccess.EntityFramework Source: https://entityframework-extensions.net/oracle-provider Command to install the Oracle Managed Data Access Entity Framework NuGet package. ```powershell PM> Install-Package Oracle.ManagedDataAccess.EntityFramework ``` -------------------------------- ### Example 2 Source: https://entityframework-extensions.net/article-template A basic SQL SELECT statement. ```sql SELECT 1 ``` -------------------------------- ### Example 2 — Bulk Insert with Staging Table Source: https://entityframework-extensions.net/logging This example demonstrates a bulk insert operation using a staging table, which is Entity Framework Extensions' default approach. The log details the creation of a temporary table, indexing, data loading via SqlBulkCopy, merging into the destination table using a MERGE statement with an OUTPUT clause, logging parameters and timing, and finally dropping the temporary table. ```sql -- Executing Command: CREATE TABLE #ZZZProjects_5e417609_6377_4596_a517_6cf250906727 ( [ColumnString] nvarchar (max) COLLATE SQL_Latin1_General_CP1_CI_AI NULL, [ID] [sys].[int] NULL, ZZZ_Index [INT] NOT NULL ) CREATE CLUSTERED INDEX [INDEX_#ZZZProjects_5e417609_6377_4596_a517_6cf250906727] ON #ZZZProjects_5e417609_6377_4596_a517_6cf250906727 (ZZZ_Index ASC); -- CommandTimeout:0 -- Executing at 2025-08-19 10:27:44 AM -- Completed at 2025-08-19 10:27:44 AM -- Result: -1 SqlBulkCopy: #ZZZProjects_5e417609_6377_4596_a517_6cf250906727 -- BulkCopyTimeout:0 Executing at 2025-08-19 10:27:44 AM Completed at 2025-08-19 10:27:44 AM -- Executing Command: MERGE INTO [EntitySimples] AS DestinationTable USING ( SELECT TOP 100 PERCENT * FROM #ZZZProjects_5e417609_6377_4596_a517_6cf250906727 WHERE ZZZ_Index >= @IndexStart AND ZZZ_Index <= @IndexEnd ORDER BY ZZZ_Index ) AS StagingTable ON 1 = 2 WHEN NOT MATCHED THEN INSERT ( [ColumnString] ) VALUES ( [ColumnString] ) OUTPUT $action, StagingTable.ZZZ_Index, INSERTED.[ID] AS [ID_zzzinserted] ; -- @IndexStart: 0 (Type = Int32, Size = 0) -- @IndexEnd: 2 (Type = Int32, Size = 0) -- CommandTimeout:0 -- Executing at 2025-08-19 10:27:44 AM -- Completed at 2025-08-19 10:27:44 AM -- Result: 3 rows -- Executing Command: DROP TABLE #ZZZProjects_5e417609_6377_4596_a517_6cf250906727; -- CommandTimeout:0 -- Executing at 2025-08-19 10:27:44 AM -- Completed at 2025-08-19 10:27:44 AM -- Result: -1 ``` -------------------------------- ### IgnoreOnDeleteMatchedAndOneNotConditionNames Example Source: https://entityframework-extensions.net/delete-matched-and-one-not-condition This example shows how to use IgnoreOnDeleteMatchedAndOneNotConditionNames to exclude properties by their names from the delete comparison. ```csharp context.BulkDelete(customers, options => { options.IgnoreOnDeleteMatchedAndOneNotConditionNames = new List() { nameof(Customer.CustomerID), nameof(Customer.Name), nameof(Customer.Email), nameof(Customer.Note) }; }); ``` -------------------------------- ### IgnoreOnDeleteMatchedAndOneNotConditionExpression Example Source: https://entityframework-extensions.net/delete-matched-and-one-not-condition This example demonstrates how to use IgnoreOnDeleteMatchedAndOneNotConditionExpression to exclude specific properties from the delete comparison. ```csharp context.BulkDelete(customers, options => { options.IgnoreOnDeleteMatchedAndOneNotConditionExpression = x => new { x.CustomerID, x.Name, x.Email, x.Note }; }); ``` -------------------------------- ### SynchronizeKeepIdentity Example Source: https://entityframework-extensions.net/synchronize-keep-identity This example demonstrates how to use SynchronizeKeepIdentity to preserve source identity values during a Synchronize operation. ```csharp using (var context = new EntityContext()) { var list = context.Customers.ToList(); list.ForEach(x => x.Name += "_Synchronize" ); list.ForEach(x => x.IdentityInt += 100 ); list.Add( new Customer() { CustomerID = 3, IdentityInt = 4, Name ="Customer_C" }); context.BulkMerge(list, options => options.SynchronizeKeepIdentity = true); } ``` -------------------------------- ### Configuring Options Source: https://entityframework-extensions.net/bulk-delete Demonstrates different ways to configure options for the BulkDelete method. ```csharp // @nuget: Z.EntityFramework.Extensions.EFCore using Z.EntityFramework.Extensions; // Using a lambda expression (only works with one option) context.BulkDelete(list, options => options.IncludeGraph = true); // Using a lambda expression with a body (works with one or multiple options) context.BulkDelete(list, options => { options.IncludeGraph = true; options.ColumnPrimaryKeyExpression = x => new { x.ID }; }); // Using a `BulkOperationOption` instance var options = context.CreateBulkOptions(); options.IncludeGraph = true; options.ColumnPrimaryKeyExpression = x => new { x.ID }; context.BulkDelete(list, options); ``` -------------------------------- ### MergeKeepIdentity Example Source: https://entityframework-extensions.net/merge-keep-identity This example demonstrates how to use MergeKeepIdentity to preserve source identity values during a MERGE operation. ```csharp using (var context = new EntityContext()) { var list = context.Customers.ToList(); list.ForEach(x => x.Name += "_Merged" ); list.ForEach(x => x.IdentityInt += 100 ); list.Add( new Customer() { CustomerID = 3, IdentityInt = 4, Name ="Customer_C" }); context.BulkMerge(list, options => options.MergeKeepIdentity = true); } ``` -------------------------------- ### Install Z.EntityFramework.Extensions.EFCore NuGet Package Source: https://entityframework-extensions.net/connection-interception-in-ef-core Command to install the necessary NuGet package for EF Core connection interception. ```powershell PM> Install-Package Z.EntityFramework.Extensions.EFCore ``` -------------------------------- ### Register EF Core Provider Source: https://entityframework-extensions.net/efcore-mysql-provider Command to install MySql.Data.EntityFrameworkCore. ```powershell PM> Install-Package MySql.Data.EntityFrameworkCore ``` -------------------------------- ### MatchedAndOneNotCondition Example Source: https://entityframework-extensions.net/matched-and-one-not-condition This example demonstrates how to use the MatchedAndOneNotCondition option to update only when 'Name' or 'Email' differs between the source and destination. ```csharp // @nuget: Z.EntityFramework.Extensions.EFCore using Z.EntityFramework.Extensions; context.BulkMerge(customers, options => { // ON UPDATE: only update if "Name" or "Email" is different between source and destination options.MergeMatchedAndOneNotConditionExpression = x => new { x.Name, x.Email }; }); ``` -------------------------------- ### Configuring Options Source: https://entityframework-extensions.net/bulk-synchronize Demonstrates different ways to pass options to the `BulkSynchronize` method, including using lambda expressions for single or multiple options, and using a `BulkOperationOption` instance for reusability and organization. ```csharp // @ nuget: Z.EntityFramework.Extensions.EFCore using Z.EntityFramework.Extensions; // Using a lambda expression (only works with one option) context.BulkSynchronize(list, options => options.SynchronizeKeepIdentity = true); // Using a lambda expression with a body (works with one or multiple options) context.BulkSynchronize(list, options => { options.SynchronizeKeepIdentity = true; options.ColumnPrimaryKeyExpression = x => new { x.ID }; }); // Using a `BulkOperationOption` instance var options = context.CreateBulkOptions(); options.SynchronizeKeepIdentity = true; options.ColumnPrimaryKeyExpression = x => new { x.ID }; context.BulkSynchronize(list, options); ``` -------------------------------- ### Configuring Options Using a Lambda Expression Source: https://entityframework-extensions.net/configure-options Demonstrates configuring multiple options directly within the method call using a lambda expression. ```csharp // @nuget: Z.EntityFramework.Extensions.EFCore using Z.EntityFramework.Extensions; context.BulkInsert(list, options => { options.BatchSize = 1000; options.BatchTimeout = 60; options.ColumnPrimaryKeyExpression = x => x.ID; }); ``` -------------------------------- ### DeleteMatchedAndConditionExpression Example Source: https://entityframework-extensions.net/delete-matched-and-condition This example demonstrates how to use the DeleteMatchedAndConditionExpression to only delete customers if their 'Version' property matches between the source and destination. ```csharp // @nuget: Z.EntityFramework.Extensions.EFCore using Z.EntityFramework.Extensions; context.BulkDelete(customers, options => { // ON DELETE: only delete customers if "Version" has the same value in both source and destination options.DeleteMatchedAndConditionExpression = x => new { x.Version }; }); ``` -------------------------------- ### Handling Duplicate Key on Root Example Source: https://entityframework-extensions.net/v7-100-0-0-include-graph This example demonstrates a scenario where different customers are added to a list but share the same key. ```csharp public class Customer { public int CustomerID { get; set; } public string Name { get; set; } } List customers = new List(); customers.Add(new Customer { CustomerID = 1, Name = "ZZZ Projects" }); customers.Add(new Customer { CustomerID = 1, Name = "Jonathan Magnan" }); ``` -------------------------------- ### EF BulkSaveChanges Example Source: https://entityframework-extensions.net/fastest-way-to-insert Demonstrates how to use the BulkSaveChanges method with different options for performance optimization. ```csharp ctx.BulkSaveChanges(); ctx.BulkSaveChanges(useEntityFrameworkPropagation: false); ctx.BulkSaveChanges(options => { options.AllowConcurrency = false; options.ForceUpdateUnmodifiedValues = false; }); ``` -------------------------------- ### Insert with Identity Example Source: https://entityframework-extensions.net/logging This SQL log example shows an insert operation where `options.InsertKeepIdentity = true;` is used, detailing the `IDENTITY_INSERT` status, SQL command, parameters, and execution metrics. ```sql -- Executing Command: SET IDENTITY_INSERT [EntitySimples] ON; INSERT INTO [EntitySimples] ( [ID], [ColumnString] ) SELECT [ID], [ColumnString] FROM (SELECT TOP 100 PERCENT * FROM (SELECT @0_0 AS [ID], @0_1 AS [ColumnString], @0_2 AS ZZZ_Index UNION ALL SELECT @1_0 AS [ID], @1_1 AS [ColumnString], @1_2 AS ZZZ_Index UNION ALL SELECT @2_0 AS [ID], @2_1 AS [ColumnString], @2_2 AS ZZZ_Index) AS StagingTable ORDER BY ZZZ_Index) AS StagingTable ; SET IDENTITY_INSERT [EntitySimples] OFF; -- @0_0: 1 (Type = Int32, Size = 4) -- @0_1: Entity Framework Extensions (Type = String, Size = -1) -- @0_2: 0 (Type = Int32, Size = 0) -- @1_0: 2 (Type = Int32, Size = 4) -- @1_1: Dapper Plus (Type = String, Size = -1) -- @1_2: 1 (Type = Int32, Size = 0) -- @2_0: 3 (Type = Int32, Size = 4) -- @2_1: C# Eval Expression (Type = String, Size = -1) -- @2_2: 2 (Type = Int32, Size = 0) -- CommandTimeout:0 -- Executing at 2025-08-19 10:25:21 AM -- Completed at 2025-08-19 10:25:21 AM -- Result: 3 ``` -------------------------------- ### MatchedAndFormula Example Source: https://entityframework-extensions.net/matched-and-formula This example shows how to use the MergeMatchedAndFormula option to update records only when the source version is greater than the destination version. ```csharp context.BulkMerge(customers, options => { // ON UPDATE: update only when the source version is greater than the destination version options.MergeMatchedAndFormula = "StagingTable.Version > DestinationTable.Version"; }); ``` -------------------------------- ### DeleteMatchedAndOneNotConditionExpression Example Source: https://entityframework-extensions.net/delete-matched-and-one-not-condition This example demonstrates how to use the DeleteMatchedAndOneNotConditionExpression to specify that a delete should only occur if the 'Version' property differs between the source and destination. ```csharp // @nuget: Z.EntityFramework.Extensions.EFCore using Z.EntityFramework.Extensions; context.BulkDelete(customers, options => { // ON DELETE: only remove if "Version" is different between source and destination options.DeleteMatchedAndOneNotConditionExpression = x => new { x.Version }; }); ``` -------------------------------- ### BulkInsert with Fluent API Options (Previous) Source: https://entityframework-extensions.net/v8-101-0-0-efcore-8 Illustrates the previous method of passing options to BulkInsert using a fluent API. ```csharp context.BulkInsert(invoices, options => { options.IncludeGraph = true }); ``` -------------------------------- ### OnMergeUpdateUseCoalesce Option Example Source: https://entityframework-extensions.net/coalesce This example shows how to use the OnMergeUpdateUseCoalesce option to apply the Coalesce behavior to all properties during a BulkMerge operation. ```csharp // @nuget: Z.EntityFramework.Extensions.EFCore using Z.EntityFramework.Extensions; context.BulkMerge(customers, options => { // ON UPDATE: modify column values only if the source value is not null options.OnMergeUpdateUseCoalesce = true; }); ``` -------------------------------- ### EF BulkInsert Example Source: https://entityframework-extensions.net/fastest-way-to-insert Shows how to use the BulkInsert method for efficient data insertion, including options for custom columns and conditional insertion. ```csharp ctx.BulkInsert(customers); ctx.BulkInsert(customers, options => { options.ColumnInputExpression = x => new {x.Code, x.Email}; options.AutoMapOutputDirection = false; options.InsertIfNotExists = true; options.InsertKeepIdentity = true; }); ```