EFCore.SoftDelete 1.1.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package EFCore.SoftDelete --version 1.1.1
NuGet\Install-Package EFCore.SoftDelete -Version 1.1.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EFCore.SoftDelete" Version="1.1.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EFCore.SoftDelete --version 1.1.1
#r "nuget: EFCore.SoftDelete, 1.1.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install EFCore.SoftDelete as a Cake Addin
#addin nuget:?package=EFCore.SoftDelete&version=1.1.1

// Install EFCore.SoftDelete as a Cake Tool
#tool nuget:?package=EFCore.SoftDelete&version=1.1.1

Ef Core Soft Delete implementation

A very simple implementation for soft deleting entities in Ef Core library.

Usage:

Step 1:

Extend your application db context from SoftDeletes.Core.DbContext.

Step 2:

In entities you want to add soft delete support, implement SoftDeletes.ModelTools.ISoftDelete interface.
It will a column named DeletedAt to your entity so you need to add a migration and update the database tables.

Step 3:

Load relations you want to delete in soft deleting the entity in LoadRelationsAsync and LoadRelations methods.

Step 4:

Delete relations you want to delete in soft deleting the entity in OnSoftDeleteAsync and OnSoftDelete methods.

Step 5:

For soft deleting an entity use Remove and RemoveAsync methods. These methods will soft delete an ISoftDelete implemented entity and force delete an not implemented entity.
For force deleting any entity use ForceRemove method.

Important Note:

It doesn't support DbSet yet, so you have to use SoftDeletes.Core.DbContext methods for removing instead of using DbSet methods.

Extra:

ITimestamps interface:

An interface for saving CreatedAt and UpdatedAt date and time of entities.
You can implement it in your entities. That will add to columns named CreatedAt and UpdatedAt to your entities.

ModelExtenstion abstract class:

An abstract class that implements ITimestamps and ISoftDelete interfaces.
You can use it in your entities.

Demo:

sample project for this implementation.

Donation:

If you like it, you can donate BTC(bitcoin) to this wallet 1LhGtAqbCt5Wra55vmNoiu3Cbzrsnye3pk

Proposal:

The proposal for this implementation.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.3.0 3,098 1/10/2022
1.1.1 1,442 7/24/2020
1.1.0 566 7/18/2020
1.0.1 454 7/18/2020
1.0.0 670 7/8/2020