- ABP Framework version: v6.0.1
- UI type: MVC
- DB provider: EF Core
- Tiered (MVC) or Auth Server Separated (Angular): Tired
- Exception message and stack trace:
- Steps to reproduce the issue:"
Hi, I have a class that inherits from the "FullAuditedAggregateRoot<Guid>" class. This inherited class already provides me with the "CreatorId" field, but it is of type Guid? I would like this field to be mandatory, how could I do it?
5 Answer(s)
-
0
hi
The design of
CreatorId
isnullable
. Because when you create an entity, there may not be a valid user in the context here -
0
If I need the CreatorId property to be mandatory, what would you recommend I do?
-
0
You can't do this. This is hardcoded in the base class. Changing it will cause other problems. Because all modules consider it to be
nullable
. -
0
What we really want to do is ensure that a user cannot be deleted if they have created reports, since we would lose the traceability of who made said report. What do you propose to do?
-
0
hi
ensure that a user cannot be deleted if they have created reports,
You can check the user's reports before deleting a user.
If there are any reports, throw user-friendly/business exceptions.