This topic describes how to batch generate application services, structure objects, and data models directly from existing domain objects.
Background
In Technical Modeling, structure objects, domain objects, and data objects often share many of the same fields. Creating each model and its fields manually can be time-consuming and difficult to maintain. To simplify this process, BizWorks lets you batch generate application services, structure objects, and data models directly from your domain objects. This feature also automatically creates the necessary mappings between models, significantly reducing your design workload.
Procedure
Log in to BizWorks, in the select Platform drop-down list selected modeling Platform.
Click the
icon or the text box in the upper-right corner of the page. From the drop-down list, click the name of the project that you want to view and click the Modeling tab. In the Modeling navigation bar, choose . -
On the bounded context page, click the name of the target bounded context.
-
In the navigation pane of the target bounded context, click domain object. On the domain object page, click Batch Generate Related Models.
-
In the Batch Generate Related Models panel, select a Generation Scope. You can choose either full generation or partial generation. By default, full generation is selected.
-
If you select full generation, click Next.
-
If you select partial generation, select the target domain objects from the list and click Next. The list includes the Domain Object Name, code, Object Type, and Description columns. Select the checkboxes for the objects you want to generate.
-
In the Generation Settings panel, configure the parameters. The panel is divided into two sections: Model Generation Scope and Other Settings. The following table describes the parameters.
Parameter
Description
Generate application services and structure objects
The following values are supported:
-
Generate
-
The system generates an application service for each domain object. The application service code is generated based on the rule: [domain object code] + Service. If the domain object code exceeds 29 characters, it is truncated to the first 29 characters.
-
For a domain object marked as an aggregate root, the generated application service will include methods for create, read, update, and delete (CRUD) operations.
-
For domain objects marked as an entity object or value object, the generated application service will only include query methods.
-
The system generates a corresponding structure object for each domain object and for any other domain objects referenced in its fields. The structure object code is generated based on the rule: [domain object code] + DTO.
-
-
Do Not Generate
Generate data models
The following values are supported:
-
Generate
-
The system generates a data model for each domain object. The data model has the same code as the domain object.
-
The system generates a data model field for each basic-type field within the domain object.
-
-
Do Not Generate
Duplicate Data Check Rule
The following values are supported:
-
Object code duplicate
-
When generating structure objects and data models, the system only checks if the model code is a duplicate. It does not compare the field codes within the model.
-
When generating an application service, the system only checks if the service code exists. It does not check the service's methods.
-
-
Field code duplicate
-
When generating structure objects and data models, if a model has a duplicate code, the system then compares its field codes for duplicates.
-
When generating an application service, the system only checks if the service code exists. It does not check the service's methods.
-
Duplicate Data Handling Policy
The following values are supported:
-
Skip Duplicates
-
When generating structure objects and data models, if a code already exists, the system does not modify the existing object's name, code, or fields.
-
When generating an application service, if an application service with the same code exists, the system does not modify it. If a method with the same code is also found, the system does not check its input and output parameters and does not regenerate the method.
-
-
Overwrite Existing Data
-
The system overwrites data (including its name and type) with the same code.
-
Data outside the generation scope is retained.
-
-
Terminate Generation: If the code of any application service, application service method, structure object, or data model duplicates an existing one, the system terminates the entire generation process and generates no data.
-
-
-
Click Start Generation. After the Generation Successful message appears, click Close.
-
You can view the generated data models, application services, and structure objects on the data model and application service pages.
NoteWhen you batch generate models, the system performs the following actions:
-
Generates an application service for each domain object. Each application service includes a method for querying by criteria.
-
Generates three structure objects as input parameters for all query methods: QueryCondition, Predicate, and OrderBy. We recommend that you do not modify these three objects, as changes may cause errors in the generated code.
-
Generates a paginated structure object named ****PageInfo for each structure object as the output parameter for query methods.
-
Generates the following mappings:
-
structure object and domain object
-
structure object and data object
-
domain object and data object
-
-
If an inheritance relationship exists between domain objects, the system preserves this relationship when generating the corresponding structure objects.
-
-