SoftDelete 1.1.1

A simple implementation for soft deleting entities that you can add it to your project and
           soft delete entities that you want to soft delete and handle related data to soft delete
           or force delete from the database.
           Documentation: https://github.com/AshkanAbd/efCoreSoftDeletes

Install-Package SoftDelete -Version 1.1.1
dotnet add package SoftDelete --version 1.1.1
<PackageReference Include="SoftDelete" Version="1.1.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SoftDelete --version 1.1.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

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.

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.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.1.1 115 7/24/2020
1.1.0 166 7/18/2020
1.0.1 189 7/18/2020
1.0.0 514 7/8/2020