Skip to content

Releases: Owen-Krueger/EntityFrameworkCore.Concurrency

8.0.1

17 Jun 22:03
Compare
Choose a tag to compare

Misc

  • Upgrade Microsoft.EntityFrameworkCore.Sqlite packages to latest
    • .NET 6.0 (6.0.31)
    • .NET 7.0 (7.0.20)
    • .NET 8.0 (8.0.6)

8.0.0

15 Nov 17:14
afac9e9
Compare
Choose a tag to compare

Changes

  • Add .NET 8.0 as a framework.
  • BREAKING: Change dependent package from Microsoft.EntityFrameworkCore.Sqlite to Microsoft.EntityFrameworkCore.
  • Update packages.

7.3.0

03 Aug 18:11
Compare
Choose a tag to compare

Changes

  • Use retry logic when using default conflict approach.

7.2.0

30 Jul 15:45
Compare
Choose a tag to compare

Changes

  • Broke from Microsoft's versioning.
  • Supports both .NET 6.0 and .NET 7.0.

7.1.0

07 Mar 03:22
77d54b9
Compare
Choose a tag to compare

Changes

  • Add extension method for DbContext objects to save changes with concurrency conflict logic
  • Rename SaveChangesWithConflictResolutionAsync to SaveChangesAsync
  • Move overload methods into specific namespaces

6.1.0

07 Mar 03:21
68af206
Compare
Choose a tag to compare

Changes

  • Add extension method for DbContext objects to save changes with concurrency conflict logic
  • Rename SaveChangesWithConflictResolutionAsync to SaveChangesAsync
  • Move overload methods into specific namespaces

7.0.0

23 Feb 21:43
Compare
Choose a tag to compare

Changes

  • Update EntityFramework to 7.0.3

6.0.0

23 Feb 21:42
Compare
Choose a tag to compare

SaveableEntities

This package adds the ability for applications using Entity Framework to handle concurrency conflicts automatically. This package should only be used with projects using EntityFramework version 7.x.x.

ISaveableEntities Interface

This adds the SaveChangesAsync method to an interface. This will allow changes to the entities to be saved to the database.

SaveChangesWithConflictResolutionAsync

This will save changes like above, but will also try to resolve any concurrency conflicts it encounters during the operation. Optionally, consumers can specify the conflict approach to take and the number of retries to attempt before failing.

There are a few different options to approach conflicts:

  • Default: Follows the default path when concurrent conflicts are encountered, which is to throw a DbUpdateConcurrencyException exception
  • ForceUpdate: Forces the property to overwrite whatever is currently set in the database.
  • SkipConflicts: Skips conflicting values to leave whatever is currently set in the database.

These approaches will be taken if the record is modified or removed between the time your context found and modified a record.

The following table shows how each approach will resolve concurrency issues. Record 1 is what the application is currently trying to set the record property to. Record 2 shows what operation happened to the record prior to our update, creating a concurrency conflict.

Record 1 Value Record 2 Value Approach Resulting Value
Apple Orange Default Exception thrown
Apple Orange ForceUpdate Apple
Apple Orange SkipConflicts Orange
Apple Record Removed Default Exception thrown
Apple Record Removed ForceUpdate Apple
Apple Record Removed SkipConflicts Record Removed

Please Note: This method can still throw exceptions if a non-concurrency exception is raised or if the retry limit was exceeded, so consumers should still add error handling around their save operations.