Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
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 http://localhost:4200/app/admin/dynamic-property

  • 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 DynamicEntityPropertyManagerComponent to manager dynamic properties of an entity

*.html

<!--...-->
<li
    *ngIf="
        dynamicEntityPropertyManager.canShow(
            'MyCompanyName.AbpZeroTemplate.Authorization.Users.User'
        )
    "
    role="menuitem"
>
    <a
        href="javascript:;"
        class="dropdown-item"
        (click)="showDynamicProperties(record)"
    >
        {{ 'DynamicProperties' | localize }}
    </a>
</li>
<!--...-->
<dynamic-entity-property-manager #dynamicEntityPropertyManager></dynamic-entity-property-manager>

*.ts

import { DynamicEntityPropertyManagerComponent } from '@app/shared/common/dynamic-entity-property-manager/dynamic-entity-property-manager.component';
@Component({
    templateUrl: './users.component.html',
    encapsulation: ViewEncapsulation.None,
    styleUrls: ['./users.component.less'],
    animations: [appModuleAnimation()],
})
export class UsersComponent extends AppComponentBase implements AfterViewInit {
    @ViewChild('dynamicEntityPropertyManager', { static: true }) dynamicEntityPropertyManager: DynamicEntityPropertyManagerComponent;

    showDynamicProperties(user: UserListDto): void {
        this.dynamicEntityPropertyManager
            .getModal()
            .show('MyCompanyName.AbpZeroTemplate.Authorization.Users.User', user.id.toString());
    }
    //...
}

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: February 19, 2024 Edit this page on GitHub
In this document