Overview
The Intent Architect Software Factory follows a well-defined execution lifecycle with multiple phases. Each phase serves a specific purpose, and factory extensions can hook into these phases to perform custom operations.Lifecycle Phases
The Software Factory execution consists of the following phases, executed in order:ExecutionLifeCycleSteps
The framework defines constants for each lifecycle step:Phase Descriptions
Start
Start
The first phase of Software Factory execution. Use this for initialization logic that must run before any other operations.Available Data:
- Application configuration
- Module metadata
- Designer metadata
- Template instances
BeforeMetadataLoad
BeforeMetadataLoad
Called before the Software Factory loads metadata from visual designers.Available Data:
- Application configuration
- Module metadata
- Prepare metadata providers
- Configure metadata loading
AfterMetadataLoad
AfterMetadataLoad
Called after all metadata has been loaded from designers. This is the first phase where you can access domain models, services, and other designer data.Available Data:
- Application configuration
- Module metadata
- Designer metadata (models, elements)
- Validate metadata
- Build metadata indexes
- Precompute derived metadata
BeforeTemplateRegistrations
BeforeTemplateRegistrations
Called before templates are registered with the Software Factory.Available Data:
- Application configuration
- Module metadata
- Designer metadata
- Prepare template dependencies
- Configure template factories
AfterTemplateRegistrations
AfterTemplateRegistrations
Called after all templates have been registered. Template instances are now available for inspection and modification.Available Data:
- Application configuration
- Module metadata
- Designer metadata
- Template instances
- Validate template configuration
- Wire up template dependencies
- Initialize file builders
BeforeTemplateExecution
BeforeTemplateExecution
Called before templates begin generating output. This is where decorator execution hooks run.Available Data:
- Application configuration
- Module metadata
- Designer metadata
- Template instances
- Decorators
- Initialize decorators
- Prepare generation context
- Set up output directories
AfterTemplateExecution
AfterTemplateExecution
Called after all templates have executed. Generated content is available but not yet written to disk.Available Data:
- Application configuration
- Module metadata
- Designer metadata
- Template instances
- Generated outputs (in memory)
- Validate generated code
- Post-process template outputs
- Generate summary reports
BeforeCommitChanges
BeforeCommitChanges
Called before changes are written to disk. Last chance to modify or cancel file operations.Available Data:
- Application configuration
- Module metadata
- Designer metadata
- Template instances
- Generated outputs (in memory)
- Pending file changes
- Review file changes
- Apply additional transformations
- Cancel specific file writes
AfterCommitChanges
AfterCommitChanges
Called after all changes have been written to disk. This is the final phase of Software Factory execution.Available Data:
- Application configuration
- Module metadata
- Designer metadata
- Template instances
- Written files
- Run external tools (formatters, linters)
- Compile generated code
- Generate documentation
- Create deployment artifacts
IExecutionLifeCycle Interface
Implementation Example
Execution Order
Multiple factory extensions can hook into the same lifecycle phase. They execute in order based on theirOrder property:
Common Patterns
Metadata Validation
Template Initialization
Post-Generation Processing
Best Practices
Choose the Right Phase
Use the earliest phase that has the data you need
Keep Phases Fast
Avoid expensive operations that slow down generation
Handle Errors Gracefully
Don’t throw exceptions that crash the Software Factory
Log Important Events
Use Logging.Log to provide visibility into extension behavior