zzz projects Entity Framework 6 EF 6
Home EF Core 5 Articles Knowledge Base Online Examples
  • Home
  • EF Core 5
  • Articles
  • Knowledge Base
  • Online Examples

Articles

11 results for:

Add or Update

AddOrUpdate...A common pattern for some applications is to either add an entity as new (resulting in a database insert) or attach an entity as existing and mark it as modified (resulting in a database update) depending on the value of the primary key....For example, when using database generated integer primary keys it is common to treat an entity with a zero key as new and an entity with a non-zero key as existing....This pattern can be achieved by setting the entity state based on a check of t...
save add-or-update

Async

Async...In Entity Framework 6, asynchronous query and save are introduced using the ...async... and ...await... keywords that were introduced in .NET 4.5....The primary purpose of async programming is to freeing up the current managed thread to do other work while it waits for an operation that does not require any compute time from a managed thread....It can be used to improve client responsiveness and server scalability when handling long-running, network or I/O-bound tasks....using (var db = ...
save async

Bulk Delete

Bulk Delete...Definition...DELETE... all entities from the database....All rows that match the entity key are ...DELETED... from the database....// Easy to use context.BulkDelete(list); // Easy to customize context.BulkDelete(customers, options => options.ColumnPrimaryKeyExpression = customer => customer.Code); ...Try it...Purpose...Deleting... entities using a custom key from file importation is a typical scenario....Despite the ...ChangeTracker... being outstanding to track what's modified, i...
save delete bulk-delete

Bulk Update

Bulk Update...Definition...UPDATE... all entities in the database....All rows that match the entity key are considered as existing and are ...UPDATED... in the database....// Easy to use context.BulkUpdate(list); // Easy to customize context.BulkUpdate(customers, options => options.ColumnPrimaryKeyExpression = customer => customer.Code); ...Try it...Purpose...Updating... entities using a custom key from file importation is a typical scenario....Despite the ...ChangeTracker... being outstanding ...
save update bulk-update

Delete Multiple Entities

Delete Multiple Entities...How to Delete Multiple Entities at Once?...When you want to delete hundreds, thousands, or millions of entities in one go....StackOverflow Related Questions...how to delete multiple rows of data with LINQ to EF using DbContext?...How do I delete multiple rows in Entity Framework (without foreach)...Answer...RemoveRange...The RemoveRange method is used for deleting multiple objects from the database in one method call. The following code deletes a large number of record...
save delete bulk-delete

Delete without Loading

Delete Without Loading...How to delete without loading entities in the context?...Deleting entities using SaveChanges requires typically to load them first in the ChangeTracker. These additional round-trips are often not necessary....StackOverflow Related Questions...Batch update/delete EF5...Answer...Entity Framework Extensions... library adds the DeleteFromQuery extension method. ...DeleteFromQuery... gives you access to directly execute a ...DELETE... statement in the database and provide a ....
save delete batch-delete

Insert Multiple Entities

Insert Multiple Entities...How to Insert Multiple Entities at Once?...When you want to insert hundreds, thousands, or millions of entities in one go....StackOverflow Related Questions...Entity Framework 6 DbSet AddRange vs IDbSet Add - How Can AddRange be so much faster?...Bulk insert using AddRange in Entity framework [closed]...Answer...AddRange...The AddRange method is used for adding multiple objects to the database in one method call. The following code inserts a large number of records int...
save insert bulk-insert

Insert Records

Insert Records...How to do a Bulk Insert?...Inserting thousand of entities for an initial load or a file importation is a typical scenario....SaveChanges... method makes it quite impossible to handle this kind of situation directly from Entity Framework due to the number of database round-trips required....SaveChanges requires one database round-trip for every entity to insert. So if you need to insert 10000 entities, then 10000 database round-trips will be performed which is ...INSANELY... slow...
save insert bulk-insert

Merge Records

Merge Records...How to Bulk Merge?...If you have a data (list of entities) which have both new and old records. ...SaveChanges... requires one database round-trip to check if the entity already exist and one round-trip to insert or update the entity....if you save 10,000 entities, 20,000 database round-trip will be performed which is ...INSANELY... slow....StackOverflow Related Questions...MERGE in Entity Framework...How can I use use Entity Framework to do a MERGE when I don't know if the recor...
save merge bulk-merge

Update Records

Update Records...How to Bulk Update?...Updating entities using a custom key from file importation is a typical scenario. Despite the ChangeTracker being outstanding to track what's modified, it lacks in term of scalability and flexibility....SaveChanges requires one database round-trip for every entity to update. So if you need to update 10000 entities, then 10000 database round-trips will be performed which is ...INSANELY... slow....StackOverflow Related Questions...Batch update/delete EF5...En...
save update bulk-update

Update without loading

Update Without Loading...How to update without loading entities in the context?...Updating entities using SaveChanges requires typically to load them first in the ChangeTracker. These additional round-trips are often not necessary....StackOverflow Related Questions...Update a record without first querying?...Update record without fetching first Entity Framework...Answer...Entity Framework Extensions... library adds the UpdateFromQuery extension method. ...UpdateFromQuery... gives you access to d...
save update batch-update

Page 1 of 1
  • 1

Prime Library

Performance

  • Entity Framework Extensions
  • Entity Framework Classic
  • Bulk Operations
  • Dapper Plus

Expression Evaluator

  • C# Eval Expression
  • SQL Eval Function
More Projects...

Related

  • EF Extensions Online Benchmark
  • WIN an EF Extensions license
  • EF6 BatchSaveChanges for only $79
Save your entities 20× faster with EF Extensions
SaveChanges vs BulkSaveChanges

EF Extensions
Try for free now