Ends in:
2 DAYS
4 HRS
19 MIN
27 SEC
Ends in:
2 D
4 H
19 M
27 S
Open Closed

CreatorId Required #8405


User avatar
0
inavarro.cp created
  • 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)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    The design of CreatorId is nullable. Because when you create an entity, there may not be a valid user in the context here

  • User Avatar
    0
    inavarro.cp created

    If I need the CreatorId property to be mandatory, what would you recommend I do?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    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.

  • User Avatar
    0
    inavarro.cp created

    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?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    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.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 02, 2024, 12:35