This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
context.BulkSaveChanges(operation => | |
{ | |
operation.BatchSize = 100; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<AuditEntry> auditEntries = new List<AuditEntry>(); | |
using (var ctx = new EntitiesContext()) | |
{ | |
ctx.BulkSaveChanges(list, operation => | |
{ | |
operation.UseAudit = true; | |
operation.BulkOperationExecuted = bulkOperation => auditEntries.AddRange(bulkOperation.AuditEntries); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// DELETE all customers that are inactive for more than two years | |
context.Customers | |
.Where(x => x.LastLogin < DateTime.Now.AddYears(-2)) | |
.DeleteFromQuery(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// UPDATE all customers that are inactive for more than two years | |
context.Customers | |
.Where(x => x.Actif && x.LastLogin < DateTime.Now.AddYears(-2)) | |
.UpdateFromQuery(x => new Customer {Actif = false}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ctx = new EntitiesContext(); | |
// Easy to use | |
ctx.BulkMerge(list); | |
// Easy to customize | |
context.BulkDelete(customers, | |
bulk => bulk.ColumnPrimaryKeyExpression = customer => customer.Code; }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ctx = new EntitiesContext(); | |
// Easy to use | |
ctx.BulkDelete(list); | |
// Easy to customize | |
context.BulkDelete(customers, | |
bulk => bulk.ColumnPrimaryKeyExpression = customer => customer.Code; }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ctx = new EntitiesContext(); | |
// Easy to use | |
ctx.BulkUpdate(list); | |
// Easy to customize | |
context.BulkUpdate(customers, | |
bulk => bulk.ColumnPrimaryKeyExpression = customer => customer.Code; }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ctx = new EntitiesContext(); | |
// Easy to use | |
ctx.BulkInsert(list); | |
// Easy to customize | |
context.BulkInsert(list, bulk => bulk.BatchSize = 100); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ctx = new EntitiesContext(); | |
ctx.Customers.AddRange(listToAdd); | |
ctx.Customers.RemoveRange(listToRemove); | |
listToModify.ForEach(x => x.DateModified = DateTime.Now); | |
// Easy to use | |
ctx.BulkSaveChanges(); | |
// Easy to customize |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<appSettings> | |
<add key="Z_EntityFramework_Extensions_LicenseName" value="[licenseName]"/> | |
<add key="Z_EntityFramework_Extensions_LicenseKey" value="[licenseKey]"/> | |
</appSettings> |