Open Closed

Attribute to define the uniqueness of a property. #10825


User avatar
0
rbautista@ecosoft.com.mx created

Hello. While reviewing an article about the built-in ABP feature called "ABP Low-Code," I noticed an attribute called "[DynamicPropertyUnique]" to define that the values ​​of that property are unique. I suggest integrating support for unique properties into the ABP Suite. Regards

Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

3 Answer(s)
  • User Avatar
    0
    AI-Bot created
    Support Team ABP Agent
    • [DynamicPropertyUnique] is an ABP Low-Code attribute used on dynamic entity properties to indicate that the value must be unique across all records for that entity. Example from the Low-Code docs:
    [DynamicPropertyUnique]
      public string ProductCode { get; set; }
    
    • ABP Suite currently doesn’t generate/configure uniqueness for properties (i.e., it doesn’t have a “unique” option you can tick in the entity designer). This matches an existing ABP support answer: Suite doesn’t have this feature; you need to enforce uniqueness yourself (e.g., check before insert/update and throw a BusinessException, and/or add a unique index at the database level).

    • About your suggestion (“integrate support for unique properties into ABP Suite”): this is a product/feature request for ABP Suite. The current workaround is:

      1. Add a unique index/constraint in your database mapping (e.g., EF Core fluent mapping / migration).
      2. Add an application-level guard (query for existing value, then throw a BusinessException) to return a user-friendly message.

    Sources (validated):

    • https://abp.io/docs/latest/low-code/fluent-api
    • https://abp.io/support/questions/764

    This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    rbautista@ecosoft.com.mx created

    Yes, I understand. I'm suggesting that ABP integrate it into future versions of ABP Suite to handle it in a consistent way. What do I need to do to get my suggestion to the ABP development team?

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Hi,

    Thanks for the suggestion. You're right, [DynamicPropertyUnique] is specific to ABP Low-Code's dynamic entities; ABP Suite's entity designer doesn't have a "unique" option today. We'll pass this on to the Suite team as a feature request.

    For now, uniqueness needs to be configured manually: add a unique index at the database level (for EF Core, b.HasIndex(x => x.ProductCode).IsUnique() plus a new migration), and check for duplicates in your app service or manager to show a friendly validation message. Put this mapping in your own model-configuration extension method (in a separate file) and call it from OnModelCreating, instead of editing the Suite-generated builder.Entity<...>(...) block — Suite removes and re-creates those blocks when you regenerate the entity.

    Thanks

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on September 28, 2026, 11:44
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.