Intent.ModuleBuilder module is a specialized Intent Architect module that enables you to design and build other Intent Architect modules using the visual designers.
Overview
Intent.ModuleBuilder provides:
- Visual designer for module structure
- Code generation for templates, decorators, and factory extensions
- API model generation for strongly-typed metadata access
- Designer configuration management
- Module packaging and versioning
Installation
Install the Module Builder module in your application:Intent.ModuleBuilderModule Builder Designer
The Module Builder designer is where you visually design your module’s structure.Designer Elements
Intent Module
Root element representing your module. Contains all templates, decorators, and configurations.
File Template
Defines a template that generates files. Supports T4, string interpolation, and custom file types.
Template Decorator
Modifies output from existing templates without changing the template source.
Factory Extension
Hooks into Software Factory lifecycle for custom logic execution.
Static Content Template
Outputs static files with optional keyword substitution.
Module Settings
Configurable settings that users can adjust in their applications.
File Templates
File Templates are the core building blocks for code generation.Template Types
C# String Interpolation
Recommended for new templates. Uses C# string interpolation for readable, maintainable templates:T4 Templates
Legacy approach using T4 (Text Template Transformation Toolkit):Binary Files
For images, PDFs, or other binary content:Template Configuration
Configure templates using stereotypes:File Settings Stereotype
File Settings Stereotype
File Extension: Output file extension (cs, ts, java, etc.)Output File Content:
Text-based- Regular text files supporting weavingBinary- Binary files (images, PDFs)
C# String Interpolation- Modern, recommendedT4 Template- Legacy, for existing templatesCustom- Full control
Template Settings Stereotype
Template Settings Stereotype
Default Location: Default output folderTemplate Output:
Single File- One file per instanceMultiple Files- Template can output multiple files
Template Registration Types
- File Per Model
- Single File
- Single File List Model
- Custom
Generates one file for each metadata element:
API Models
API models provide strongly-typed access to metadata from designers.Generating API Models
- Name:
ClassModel - Element: Select designer element type
Using API Models in Templates
Static Content Templates
For outputting static files with minimal customization:public class DefaultConfigsTemplateRegistration
: StaticContentTemplateRegistration
{
public override IReadOnlyDictionary<string, string> Replacements =>
new Dictionary<string, string>
{
{ "ProjectName", _application.Name },
{ "GeneratedDate", DateTime.Now.ToString("yyyy-MM-dd") },
{ "Author", "Your Company" }
};
}
Module Settings
Provide configurable settings for module users:// Generated settings extension class
public static class ModuleSettingsExtensions
{
public static string ConnectionString(this IApplicationSettingsProvider settings)
{
return settings.GetSetting("MyModule.ConnectionString", "Server=localhost");
}
public static bool EnableLogging(this IApplicationSettingsProvider settings)
{
return settings.GetSetting("MyModule.EnableLogging", "true").ToBool();
}
}
Module Dependencies
Define dependencies on other modules:- Always: Always update to specified version
- If Newer: Update only if newer than installed
- Never: Never automatically update
Module Packaging
Module Versioning
Follow semantic versioning (MAJOR.MINOR.PATCH):- MAJOR: Breaking changes, incompatible API changes
- MINOR: New features, backward compatible
- PATCH: Bug fixes, backward compatible
.imodspec:
Best Practices
Module Organization
- Group related templates in folders
- Keep API models separate from templates
- Use consistent naming conventions
- Document all public APIs
Performance
- Cache expensive computations in templates
- Use lazy loading for metadata queries
- Minimize Software Factory execution time
- Profile large modules for bottlenecks
Maintainability
- Keep template logic simple and focused
- Extract complex logic to helper classes
- Write unit tests for API models
- Version your modules appropriately
Testing
- Create test applications for each feature
- Test upgrade scenarios
- Verify backward compatibility
- Test with various metadata configurations
Module Builder Settings
Configure Module Builder behavior:Create Partial API Models
Generates partial classes for API models, allowing custom extensions:Dependency Version Overwrite Behavior
Control how dependency versions are updated:- Always: Always update to template version
- If Newer: Update only if newer
- Never: Never update automatically
Troubleshooting
Templates not generating
Templates not generating
Check:
- Template registration returns models in
GetModels() - Template ID matches between template and registration
- Designer references are correct
- Output target is configured properly
API models missing properties
API models missing properties
Verify:
- Designer reference includes correct designer
- Element type mapping is correct
- Software Factory was run after changes
- No generation errors in output log
Module not appearing after install
Module not appearing after install
Check:
- Module version is incremented
.imodspecsupportedClientVersions includes your Intent version- Module is built in Release mode
- Module cache is cleared
Next Steps
Creating Templates
Detailed guide on template development
Creating Decorators
Learn to modify template outputs
Factory Extensions
Hook into Software Factory lifecycle
Designer Configuration
Create custom visual designers