Entity Names

In addition to the modelName, the @Entity decorator supports other names. These include the pluralName which can be useful for dynamically describing entities in plurality in log messages, messages displayed in the ui, etc. Additionally a uriName may be specified that can be used when building API endpoint urls in your entity services.

Some examples of using the @Entity decorator to name your entities:

import { Entity } from '@briebug/ngrx-auto-entity';

@Entity('Customer')
@Entity({ modelName: 'Customer' })
@Entity('Customer', { pluralName: 'Customers' })
@Entity({ 
  modelName: 'Customer',
  pluralName: 'Customers',
  uriName: 'customers'
})
export class Customer {}

Auto-entity provides a number of utility functions for retrieving the various names of entities. Refer to the Utility Functions documentation for more information.

Last updated