Skip to content

generate entity

The generate entity command adds entity components to an existing Apiand project.

Usage

Terminal window
apiand generate entity <name> [options]

Options

Option Alias Description Required Example
--attributes -a Entity attributes specification No --attributes "name:string,age:int,status:enum[active,inactive]"

Examples

Generate an entity with attributes:

Terminal window
apiand generate entity Product --attributes "name:string,price:decimal,category:string"

Behaviors

  • DDD: Generates an entity class in the Domain layer with the specified attributes, if there are enums it creates a separate file for them.

  • Standalone: Generates an entity class and any enum classes in the Entity/path folder (where ‘path’ is derived from the entity name). For example, if the entity name is Product.Category, files will be created in Entity/Product folder.

  • SingleLayer: Same as Standalone - generates entity and enum files in the Entity/path folder based on the entity name structure.

`