Open Closed

I want to Extend the SaaS tenant table using Object Extension in microservice template and Angular solution #9304


User avatar
0
Ravikumar-Morrawthu_HON created

I am working with an ABP microservice template , and I want to extend the SaaS Tenant table by adding an extra property like TenantType.

I have tried using Object Extension features provided by ABP, and I've also created and applied EF Core migrations , but the new property does not appear in the UI (Angular front-end) .

Is it possible to extend the SaaS Tenant entity in the microservice template using object extensions and migrations?

If yes, please provide a step-by-step resolution on how to properly do this in the microservice architecture, including integration with the Angular UI

using Hon.IFS.SaasService.Enums;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.ObjectExtending;
using Volo.Abp.Threading;

namespace Hon.IFS.SaasService
{
    public static class IFSModuleExtensionConfigurator
    {
        private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner();
        public static void Configure()
        {
            OneTimeRunner.Run(() =>
            {
                ConfigureExistingProperties();
            });
        }
        private static void ConfigureExistingProperties()
        {
            ObjectExtensionManager.Instance.Modules()
                  .ConfigureSaas(saas =>
                  {
                      saas.ConfigureTenant(tenant =>
                      {
                          tenant.AddOrUpdateProperty<TenantType>( //property type: string
                              "tenantType", //property name
                              property =>
                              {
                                  //validation rules
                                  property.Attributes.Add(new RequiredAttribute());
                                  //property.Attributes.Add(new StringLengthAttribute(64) { MinimumLength = 4 });

                                  //...other configurations for this property
                              }
                          );
                      });
                  });


        }
    }
}

4 Answer(s)
  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    Hi,

    We have 2 different level extension system.

    • Object Extensions for extending objects only and extra data is kept in ExtraProperties property of the entity and data is carried over ExtraProperties in the DTO.
    • Entity Extensions for extending directly entity and database table. In that case, the extra property you add is directly stored in a new column in the databse and required database migration.

    If you used only one of them, can you try extending your object with 2 options at the same time?

    Entity extensions should directly affect to angular UI and can be shown in the pre-built module pages without changing anything

  • User Avatar
    0
    Ravikumar-Morrawthu_HON created

    Please send me the Documentation for microservice template of Entity Extensions

  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    Object Extensions: https://abp.io/docs/latest/framework/fundamentals/object-extensions Module Entity Extensions: https://abp.io/docs/latest/framework/architecture/modularity/extending/module-entity-extensions

    They're not template or UI framework specific, whenever you configure them, they'll be available to use. You can start using them by API endpoints. The problem why they don't affect angular seems different topic. I assigned this issue our @angular team and they'll help you in this incident.

    I found this feature that provides you a way to add new fields to existing module forms: https://abp.io/docs/latest/framework/ui/angular/dynamic-form-extensions Normally you don't have to do it manually but you may use it as a workaround until solution.

  • User Avatar
    0
    Ravikumar-Morrawthu_HON created

    Hi enis using the Object Extensions or Module Entity Extensions: in microservice template it not even adding the extra column to the extra properties can you try once from your side in microservice template for Saas Tenant Table.

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 v9.3.0-preview. Updated on June 13, 2025, 11:37