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
3 Answer(s)
-
0
[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:
- Add a unique index/constraint in your database mapping (e.g., EF Core fluent mapping / migration).
- 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) -
0
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) -
0
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 fromOnModelCreating, instead of editing the Suite-generatedbuilder.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)