Open Closed

Module ObjectExtension #6958


User avatar
0
infence created

Hi, How to do object Extension for a newly added module. For ex. I added Module A to the main app. I have an entity Apple in ModuleA. I need to add some field to Object Extension . how can i achieve it Provide us with the following info:

  • ABP Framework version:Abp commercial v8.0.4
  • UI Type: Blazor Server
  • Database System: EF Core (SQL Server, Oracle, MySQL, PostgreSQL, etc..)
  • Tiered (for MVC) or Auth Server Separated (for Angular): no
  • Exception message and full stack trace:
  • Steps to reproduce the issue:
Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

12 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Fullstack Developer

    Hi,

    You can check the document: https://docs.abp.io/en/abp/latest/Module-Entity-Extensions

    ObjectExtensionManager.Instance.Modules()
        .ConfigureModuleA(moduleA =>
        {
            moduleA.ConfigureApple(user =>
            {
                user.AddOrUpdateProperty<Guid>(
                    "DepartmentId",
                    property =>
                    {
                        property.UI.Lookup.Url = "/api/departments";
                        property.UI.Lookup.DisplayPropertyName = "name";
                    }
                );
            });
        });
    

    You need to create some extension methods for Module A, for example:

    https://github.com/abpframework/abp/blob/dev/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/ObjectExtending/IdentityModuleExtensionConfigurationDictionaryExtensions.cs#L8

    https://github.com/abpframework/abp/blob/dev/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/ObjectExtending/IdentityModuleExtensionConfiguration.cs#L8

    https://github.com/abpframework/abp/blob/dev/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityDbContextModelBuilderExtensions.cs#L301

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

    Hi, Thanks for the reply. I have done the same and still its not working.

    Kindly help

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

    Hi,

    Here are some configurations: https://github.com/abpframework/abp/blob/dev/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityDomainModule.cs#L26 https://github.com/abpframework/abp/blob/dev/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityDomainModule.cs#L77 https://github.com/abpframework/abp/blob/dev/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/AbpIdentityApplicationContractsModule.cs#L19 https://github.com/abpframework/abp/blob/dev/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/AbpIdentityApplicationContractsModule.cs#L28 https://github.com/abpframework/abp/blob/dev/modules/identity/src/Volo.Abp.Identity.Web/AbpIdentityWebModule.cs#L107

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

    Hi, ModuleExtensionConfigurationHelper .ApplyEntityConfigurationToUi( IdentityModuleExtensionConsts.ModuleName, IdentityModuleExtensionConsts.EntityNames.User, createFormTypes: new[] { typeof(Volo.Abp.Identity.Web.Pages.Identity.Users.CreateModalModel.UserInfoViewModel) }, editFormTypes: new[] { typeof(Volo.Abp.Identity.Web.Pages.Identity.Users.EditModalModel.UserInfoViewModel) } ); in CreateFormTypes what will come for BlazorServer UI

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

    Hi,

    This is the Blazor server config:

    https://github.com/abpframework/abp/blob/dev/modules/identity/src/Volo.Abp.Identity.Blazor/AbpIdentityBlazorModule.cs#L58

    It will automatically add extension fields to create and edit UI

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

    ObjectExtensionManager.Instance.Modules() .ConfigureModuleA(moduleA => { moduleA.ConfigureApple(user => { user.AddOrUpdateProperty<Guid>( "DepartmentId", property => { property.UI.Lookup.Url = "/api/departments"; property.UI.Lookup.DisplayPropertyName = "name"; } ); }); }); property.UI.Lookup.Url = "/api/departments"; property.UI.Lookup.DisplayPropertyName = "name"; why is this needed? is this controller Route

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

    Hi,

    This is just an example code; you can check the document https://docs.abp.io/en/abp/latest/Module-Entity-Extensions

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

    Hi, Got it.. Thanks

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

    : )

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

    Hi, alil more help with this. how to add the extensionproperty in DataGrid

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

    This is how ABP did :

    https://github.com/abpframework/abp/blob/dev/modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/UserManagement.razor.cs#L230-L231 https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.BlazoriseUI/Components/AbpExtensibleDataGrid.razor#L121-L156

    The suite generated code for Blazor UI doesn't support module object extension yet, we will improve it in 8.3 version.

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

    Thank you

    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 16, 2026, 14:50
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.