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.
This NuGet package contains a base entity definition along with an entity service which handles the update, soft 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 service are all `virtual`, so you can extend them to fit your needs if you e.g. need more base attributes set automatically.
4
+
5
+
## BaseEntity
6
+
The base entity contains the following properties:
7
+
8
+
| Name | Type | Description |
9
+
| ---- | ---- | ----------- |
10
+
| Id | Guid? | The unique id of the entity |
11
+
| Created | DateTime | The UTC time for when this entity was created |
12
+
| Updated | DateTime | The UTC time for when this entity was last updated |
13
+
| DeletedAt | DateTime? | The UTC time for when this entity was soft deleted |
14
+
| Deleted | bool | Whether the entity is deleted or not |
15
+
16
+
## EntityRepository
17
+
This is the entity service which handles the communication with the database. There is also an interface `IEntityRepository`, so you can use DI to inject it into your code.
18
+
19
+
| Function | Description |
20
+
| -------- | ----------- |
21
+
| Get | Fetch a single entity |
22
+
| GetList | Get a filtered and possibly paginated list of entities |
23
+
| Add | Add a new entity to the DB. The function automatically sets `Created`, `Updated`, and `Id` on the entity |
24
+
| Update | Update the provided entity in the DB. The function automatically sets `Updated`|
25
+
| Delete | Soft delete the entity. Sets `Deleted` to `true` and sets `Deleted` as well |
26
+
| Restore | Undelete the entity. Sets `Deleted` to `false` and sets `DeletedAt` to `null`|
0 commit comments