You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 20, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+14-14Lines changed: 14 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,21 +2,21 @@
2
2
3
3
This NuGet package contains a base entity definition along with an entity service which handles the update, delete, add etc. which automatically sets the properties on the base entity and does some basic validation. Every class is extendable, so you can fit it to your needs. The `Add`, `Delete`, `Update`, and `Restore` functions on the entity services are all `virtual`, so you can extend them to fit your needs if you e.g. need more base attributes set automatically.
4
4
5
-
The class `BaseEntity` is for hard delete entities while `BaseSoftDeleteEntity` is for entities which are only soft deleted. There are repositories for each type of entity as well with mostly the same functionality although the soft delete version has a few extra parameters and also has a restore function.
5
+
The class `EntityBase` is for hard delete entities while `EntitySoftDeleteBase` is for entities which are only soft deleted. There are repositories for each type of entity as well with mostly the same functionality although the soft delete version has a few extra parameters and also has a restore function.
6
6
7
7
## Entities
8
8
9
-
### BaseEntity
9
+
### EntityBase
10
10
The base entity contains the following properties:
11
11
12
12
| Name | Type | Description |
13
13
| ---- | ---- | ----------- |
14
-
| Id |Guid?| The unique id of the entity |
14
+
| Id |TId| The unique id of the entity |
15
15
| Created | DateTime | The UTC time for when this entity was created |
16
16
| Updated | DateTime | The UTC time for when this entity was last updated |
17
17
18
18
### BaseSoftDeleteEntities
19
-
This class extends `BaseEntity` and adds the following properties:
19
+
This class extends `EntityBase` and adds the following properties:
20
20
21
21
| Name | Type | Description |
22
22
| ---- | ---- | ----------- |
@@ -30,21 +30,21 @@ This is the entity service which handles the communication with the database. Th
30
30
31
31
| Function | Description |
32
32
| -------- | ----------- |
33
-
|Get| Fetch a single entity |
34
-
|GetList| Get a filtered and possibly paginated list of entities |
35
-
|GetListWithSelect| Get a filtered and possibly paginated list of entities where you can specify what properties to return |
36
-
|Add| Add a new entity to the DB. The function automatically sets `Created`, `Updated`, and `Id` on the entity |
37
-
|Update| Update the provided entity in the DB. The function automatically sets `Updated`|
38
-
|Delete| Removes the entity from the DB |
33
+
|GetAsync| Fetch a single entity |
34
+
|GetListAsync| Get a filtered and possibly paginated list of entities |
35
+
|GetListWithSelectAsync| Get a filtered and possibly paginated list of entities where you can specify what properties to return |
36
+
|AddAsync| Add a new entity to the DB. The function automatically sets `Created`, `Updated`, and `Id` on the entity |
37
+
|UpdateAsync| Update the provided entity in the DB. The function automatically sets `Updated`|
38
+
|DeleteAsync| Removes the entity from the DB |
39
39
40
40
### EntitySoftDeleteRepository
41
41
This entity repository handles soft delete entities. It implements the interface `IEntitySoftDeleteRepository` for DI purposes.
42
42
43
-
For each method in `EntityRepository` where relevant, there are extra parameters for handling soft delete entities e.g. `GetList` where you can choose whether to include deleted in the result list or not (not by default).
43
+
For each method in `EntityRepository` where relevant, there are extra parameters for handling soft delete entities e.g. `GetListAsync` where you can choose whether to include deleted in the result list or not (not by default).
44
44
45
-
Along with the methods from `EntityRepository`, this repository implements the following extra methods along with changed behaviour on `Delete`:
45
+
Along with the methods from `EntityRepository`, this repository implements the following extra methods along with changed behaviour on `DeleteAsync` including extra parameters regarding to soft delete behaviour on the other functions:
46
46
47
47
| Function | Description |
48
48
| -------- | ----------- |
49
-
|Delete| Soft delete the entity. Sets `Deleted` to `true` and sets `Deleted` as well |
50
-
|Restore| Undelete the entity. Sets `Deleted` to `false` and sets `DeletedAt` to `null`|
49
+
|DeleteAsync| Soft delete the entity. Sets `Deleted` to `true` and sets `Deleted` as well |
50
+
|RestoreAsync| Undelete the entity. Sets `Deleted` to `false` and sets `DeletedAt` to `null`|
0 commit comments