Updated Repository Layer (markdown)

2881099
2023-12-07 13:12:17 +08:00
parent c015429697
commit bb633b3024

@@ -124,15 +124,15 @@ Dictionary<string, object[]> CompareState(TEntity newdata);
Suppose we have two entities: `User` and `Topic`, and two repositories are defined in the domain class: Suppose we have two entities: `User` and `Topic`, and two repositories are defined in the domain class:
```csharp ```csharp
var userRepository = fsql.GetGuidRepository<User>(); var userRepository = fsql.GetRepository<User>();
var topicRepository = fsql.GetGuidRepository<Topic>(); var topicRepository = fsql.GetRepository<Topic>();
``` ```
In practice, we always worry about the data security of `topicRepository`, that is, it is possible to query or change the topic of other users. Therefore, we have made improvements in the v0.0.7 version, adding the filter lambda expression parameter. In practice, we always worry about the data security of `topicRepository`, that is, it is possible to query or change the topic of other users. Therefore, we have made improvements in the v0.0.7 version, adding the filter lambda expression parameter.
```csharp ```csharp
var userRepository = fsql.GetGuidRepository<User>(a => a.Id == 1); var userRepository = fsql.GetRepository<User>(a => a.Id == 1);
var topicRepository = fsql.GetGuidRepository<Topic>(a => a.UserId == 1); var topicRepository = fsql.GetRepository<Topic>(a => a.UserId == 1);
``` ```
* Attach this condition when querying/modifying/deleting, so that the data of other users will not be modified. * Attach this condition when querying/modifying/deleting, so that the data of other users will not be modified.