Project

Dynamic Property System

Dynamic Property System is a system that allows you to add and manage new properties on entity objects at runtime without any code changes. With this system, you can define dynamic propeties on entity objects and perform operations on these objects easily. For example, it can be used for cities, counties, gender, status codes etc.

Check AspNet Boilerplate side of Dynamic Property System

Defining

  • Firs of all you need to define input types and entities you want to use with dynamic properties as described here

  • Then go to https://localhost:44302/App/DynamicProperty

  • Add Dynamic Properties that you need

  • Assign Dynamic Properties to your entity

dynamic-properties
  • Then you will be able to use dynamic property for the items of your entity.

You can use DynamicEntityPropertyManager to manager dynamic properties of an entity

Add javascript

<script abp-src="/view-resources/Areas/AppAreaName/Views/Common/_DynamicEntityPropertyManager.js" asp-append-version="true"></script>

Then you can use it to show modal

var _dynamicEntityPropertyManager = new DynamicEntityPropertyManager();

var canShow = _dynamicEntityPropertyManager.canShow('YOURENTITYNAME');//is entity defined and user has related permission to edit dynamic entities
if(canShow){
    _dynamicEntityPropertyManager.modal.open({
        entityFullName: 'MyCompanyName.AbpZeroTemplate.Authorization.Users.User',
        rowId: data.record.id,
    });
}

For example you can use it in list page action

var dataTable = _$usersTable.DataTable({
        //...
        columnDefs: [
            {
                targets: 1,
                data: null,
                orderable: false,
                autoWidth: false,
                defaultContent: '',
                rowAction: {
                    text:
                        '<i class="fa fa-cog"></i> <span class="d-none d-md-inline-block d-lg-inline-block d-xl-inline-block">' +
                        app.localize('Actions') +
                        '</span> <span class="caret"></span>',
                    items: [
                        //..
                        {
                            text: app.localize('DynamicProperties'),
                            visible: function () {
                                return _dynamicEntityPropertyManager.canShow(
                                    'MyCompanyName.AbpZeroTemplate.Authorization.Users.User'
                                );
                            },
                            action: function (data) {
                                _dynamicEntityPropertyManager.modal.open({
                                    entityFullName: 'MyCompanyName.AbpZeroTemplate.Authorization.Users.User',
                                    rowId: data.record.id,
                                });
                            },
                        }
                    ]
                }
            }

        ],
    });
dynamic-propert-of-entity
Property Summary
PropertyName* Unique name of the dynamic property
Input Type* Input type name of the dynamic property
Permission Required permission to manage anything about that property
(DynamicPropertyValue, EntityDynamicProperty, EntityDynamicPropertyValue)

Contributors


Last updated: November 22, 2023 Edit this page on GitHub
In this document