generate entity
The generate entity command adds entity components to an existing Apiand project.
Usage
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:
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 theEntity/pathfolder (where ‘path’ is derived from the entity name). For example, if the entity name isProduct.Category, files will be created inEntity/Productfolder. -
SingleLayer: Same as Standalone - generates entity and enum files in theEntity/pathfolder based on the entity name structure.
`