Open Closed

Can I create ExtraProperties and check their existence before updating or adding new data? #5904


User avatar
0
thuc.nghiem@techplus.vn created
  • ABP Framework version: v7.0.1
  • UI Type: Angular
  • Database System: EF Core ( Oracle.)
  • Tiered (for MVC) or Auth Server Separated (for Angular): no
  • Exception message and full stack trace:
  • Steps to reproduce the issue:
ObjectExtensionManager.Instance.Modules().ConfigureIdentity(identity =>
        {
            identity.ConfigureUser(user =>
            {
                user.AddOrUpdateProperty<string>(UserConsts.LoanOfficer,
                    options =>
                    {
                        options.Attributes.Add(new RequiredAttribute());
                        options.Attributes.Add(new StringLengthAttribute(UserConsts.MaxLoanOfficerLength));
                        //options.UI.OnEditForm.IsVisible = false;

                    });
                

                user.Validators.Add(context =>
                {
                   //help check exist??
                });

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

2 Answer(s)
  • User Avatar
    0
    Anjali_Musmade created
    Support Team Member

    Hello thuc.nghiem@techplus.vn,

    As you are using RequiredAttribute for LoanOfficer, If you have not passing value for LoanOfficer from UI then it will through error/Exception.

    If you want to implement custom validation you can refer this https://docs.abp.io/en/abp/latest/Object-Extensions#custom-validation

    Regards, Anjali

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    thuc.nghiem@techplus.vn created

    Hello Anjali. My problem is to check if it already exists and prevent it from being saved to the database. Can you provide a solution for me?

    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.