Designers
Designers are visual modeling tools in Intent Architect that allow users to create metadata models. The most common designers are Domain Designer, Services Designer, and Database Designer.
Designer Configuration
Each designer is configured using a .designer.config XML file that defines the designer’s identity, element types, and associations.
Basic Structure
<? xml version = "1.0" encoding = "utf-8" ?>
< config >
< id > 6ab29b31-27af-4f56-a67c-986d82097d63 </ id >
< name > Domain </ name >
< order > 10 </ order >
< icon type = "UrlImagePath" source = "data:image/svg+xml;base64,..." />
< loadStartPage > false </ loadStartPage >
< designerReferences >
< designerReference id = "55d06096-83fe-4acf-86ef-586d254e5170"
name = "Common Types"
module = "Intent.Common.Types" />
< designerReference id = "db2f5755-5256-46d1-bb45-72bf2c7cde42"
name = "Domain Types"
module = "Intent.Modelers.Domain" />
</ designerReferences >
< packageReferences />
</ config >
Key Configuration Elements
Unique identifier for the designer
Display name shown in the Intent Architect UI
Sort order when displaying multiple designers
Visual icon for the designer (SVG or image path)
Designer References
Designers can reference other designers to reuse element types:
< designerReferences >
<!-- Reference Common Types for primitives like string, int, etc. -->
< designerReference id = "55d06096-83fe-4acf-86ef-586d254e5170"
name = "Common Types"
module = "Intent.Common.Types" />
<!-- Reference Domain Designer for domain types -->
< designerReference id = "db2f5755-5256-46d1-bb45-72bf2c7cde42"
name = "Domain Types"
module = "Intent.Modelers.Domain" />
</ designerReferences >
Designer references allow elements in one designer to reference types defined in another designer.
Element Types
Designers define the types of elements that can be created. While the full element configuration is complex, here’s a conceptual overview:
Common Element Types
Class Represents a class or entity with properties and methods
Interface Defines a contract with method signatures
Enum Enumeration with named values
Association Relationship between two elements
Element Configuration Example
Here’s a simplified example of how a “Class” element might be configured:
< elementType >
< id > class-element-type-id </ id >
< name > Class </ name >
< icon > class-icon.svg </ icon >
< allowMultiple > true </ allowMultiple >
< properties >
< property name = "Name" type = "string" required = "true" />
< property name = "Comment" type = "text" />
< property name = "IsAbstract" type = "boolean" default = "false" />
</ properties >
< childElements >
< childElement type = "attribute-element-type-id" />
< childElement type = "operation-element-type-id" />
</ childElements >
</ elementType >
Stereotypes
Designers can define stereotypes that extend element types:
< stereotypes >
< stereotype name = "Table" appliesTo = "Class" >
< property name = "Name" type = "string" >
< hint > Override the table name in the database </ hint >
</ property >
< property name = "Schema" type = "string" >
< hint > Database schema name </ hint >
< defaultValue > dbo </ defaultValue >
</ property >
</ stereotype >
< stereotype name = "Primary Key" appliesTo = "Attribute" >
< property name = "Identity" type = "boolean" default = "true" >
< hint > Use auto-increment identity column </ hint >
</ property >
</ stereotype >
</ stereotypes >
Stereotype Properties
Stereotypes support various property types:
string - Text input
text - Multi-line text
boolean - Checkbox
number - Numeric input
select - Dropdown with options
multi-select - Multiple selection
element-reference - Reference to another element
Properties can be marked as required and have default values: < property name = "TableName"
type = "string"
required = "true"
default = "{element.Name}" >
< hint > Name of the database table </ hint >
< validations >
< regex pattern = "^[a-zA-Z][a-zA-Z0-9_]*$"
message = "Must start with letter and contain only letters, numbers, and underscores" />
</ validations >
</ property >
Designer Settings
Designers can define settings that apply to all elements:
< settings >
< setting name = "Default Namespace" type = "string" default = "MyCompany.MyApp" />
< setting name = "Use Nullable Reference Types" type = "boolean" default = "true" />
< setting name = "Collection Type" type = "select" default = "List" >
< options >
< option value = "List" />
< option value = "IEnumerable" />
< option value = "ICollection" />
< option value = "HashSet" />
</ options >
</ setting >
</ settings >
Packages and Folders
Designers support organizing elements into packages and folders:
< packageExtensions >
< packageExtension type = "Folder" >
< creationOptions >
< option type = "element-name" />
< option type = "diagram" />
</ creationOptions >
< childElements >
< childElement type = "class-type-id" />
< childElement type = "interface-type-id" />
< childElement type = "enum-type-id" />
< childElement type = "folder-type-id" />
</ childElements >
</ packageExtension >
</ packageExtensions >
Creating Custom Designers
To create a custom designer:
Create Designer Config
Create a .designer.config file with unique ID and element types
Define Element Types
Specify what elements users can create (classes, operations, etc.)
Define Stereotypes
Create stereotypes to extend elements with additional metadata
Package in Module
Include the designer config in a module’s metadata section
Create API Models
Generate strongly-typed C# models for accessing designer metadata
Create Templates
Build templates that consume the designer’s metadata
Designer APIs
Intent Architect generates strongly-typed C# APIs for accessing designer metadata:
// Generated API for accessing domain models
public static class DomainMetadataExtensions
{
public static IEnumerable < ClassModel > GetClassModels ( this IMetadataManager manager )
{
return manager . GetMetadata < ClassModel >( "Domain" );
}
}
public class ClassModel : IMetadataModel
{
public string Id { get ; }
public string Name { get ; }
public string Comment { get ; }
public bool IsAbstract { get ; }
public ClassModel BaseClass { get ; }
public IEnumerable < AttributeModel > Attributes { get ; }
public IEnumerable < OperationModel > Operations { get ; }
// Stereotype accessors
public bool HasTableStereotype () => this . HasStereotype ( "Table" );
public TableSettings GetTableSettings () => new TableSettings ( GetStereotype ( "Table" ));
}
public class AttributeModel : IMetadataModel
{
public string Id { get ; }
public string Name { get ; }
public ITypeReference TypeReference { get ; }
public bool IsNullable { get ; }
public bool IsCollection { get ; }
}
Example: Domain Designer
The Domain Designer is one of the most commonly used designers:
Features
Classes Define domain entities with properties and operations
Associations Create relationships between classes (1-to-1, 1-to-many, many-to-many)
Inheritance Model class hierarchies
Enumerations Define enums with named values
Common Stereotypes
Table - Maps class to database table
Primary Key - Marks property as primary key
Foreign Key - Defines foreign key relationship
Index - Creates database index
Auditable - Adds audit fields (created/modified dates)
Accessing Designer Data in Templates
public class EntityTemplateRegistration : FilePerModelTemplateRegistration < ClassModel >
{
public override string TemplateId => "MyModule.EntityTemplate" ;
public override IEnumerable < ClassModel > GetModels ( IApplication application )
{
// Get all classes from Domain designer
return application . MetadataManager
. Domain ( application )
. GetClassModels ()
. Where ( x => x . HasTableStereotype ());
}
public override ITemplate CreateTemplateInstance ( IOutputTarget outputTarget , ClassModel model )
{
return new EntityTemplate ( TemplateId , outputTarget , model );
}
}
Diagram Configuration
Designers can configure how elements appear in diagrams:
< diagrams >
< diagram type = "Class Diagram" >
< elementVisuals >
< elementVisual type = "class-type-id" >
< shape type = "Rectangle" />
< compartments >
< compartment name = "Attributes" show = "attributes" />
< compartment name = "Operations" show = "operations" />
</ compartments >
</ elementVisual >
< elementVisual type = "association-type-id" >
< shape type = "Line" />
< endDecorators >
< decorator when = "isCollection" type = "Arrow" />
</ endDecorators >
</ elementVisual >
</ elementVisuals >
</ diagram >
</ diagrams >
Module Builder Designer
Intent Architect includes a Module Builder designer for creating modules visually:
Templates Define templates with T4 or Razor syntax
Decorators Create decorator contracts and implementations
Factory Extensions Build factory extensions visually
Stereotypes Define reusable stereotypes
Best Practices
Clear Element Names Use descriptive names for element types
Helpful Hints Provide hints for all stereotype properties
Sensible Defaults Set appropriate default values
Validation Add validation rules to prevent invalid models
Designer Extensions
Modules can extend existing designers by adding:
New stereotypes
New element types
New associations
New settings
<!-- In module's .imodspec -->
< metadata >
< install target = "Domain"
src = "metadata/domain-extensions.pkg.config"
externalReference = "extension-id" />
</ metadata >
The extension package can add stereotypes to existing element types:
<!-- domain-extensions.pkg.config -->
< package >
< stereotypes >
< stereotype name = "Soft Delete" appliesTo = "Class" >
< property name = "Delete Field Name" type = "string" default = "IsDeleted" />
</ stereotype >
</ stereotypes >
</ package >
Metadata System Work with designer metadata
Templates Generate code from designer models
Modules Package designers in modules