Overview
The Domain Modeler is based on theIntent.Modelers.Domain module, which provides:
- UML class diagram-based visual modeling
- Support for entities, value objects, and data contracts
- Rich relationship modeling (associations, generalizations)
- Attribute and operation definitions
- Domain-specific stereotypes and metadata
Designer Configuration
The Domain designer is configured with:- Designer ID:
6ab29b31-27af-4f56-a67c-986d82097d63 - Designer Name: Domain
- Order: 10 (appears after Services in the designer list)
- Type Systems: Common Types, Domain Types
Core Elements
Class (Entity)
Classes represent domain entities - objects with identity and lifecycle. Properties:- Name: The entity name (e.g.,
Customer,Order) - Abstract: Whether the class is abstract
- Attributes: Properties/fields on the entity
- Operations: Methods and behaviors
- Constructors: Constructor definitions
Attribute
Attributes represent properties or fields on classes. Properties:- Name: Attribute name
- Type: Data type (primitives, enums, or other classes)
- Default Value: Optional default value
- Is Nullable: Whether the attribute can be null
- Is Collection: Whether it’s a collection type
Association
Associations represent relationships between classes. Association Types:- Aggregation: Whole-part relationship (e.g., Order has OrderItems)
- Composition: Strong ownership (part cannot exist without whole)
- Association: General relationship
- Source End: The source class and multiplicity
- Target End: The target class and multiplicity
- Navigability: Whether the relationship is navigable in one or both directions
0..1- Zero or one1- Exactly one0..*- Zero or many1..*- One or many
Generalization (Inheritance)
Generalizations represent inheritance relationships.Data Contract
Data contracts represent value objects or simple data transfer structures without identity.Operation
Operations define methods and behaviors on domain entities. Properties:- Name: Operation name
- Return Type: The type returned by the operation
- Parameters: Input parameters
- Is Static: Whether it’s a static method
- Is Abstract: Whether it’s an abstract method
Folder
Folders organize domain elements hierarchically, typically mapping to namespaces.Domain Modeling Patterns
Entities
Entities are objects with unique identity that persist over time. Characteristics:- Have a unique identifier (typically an
Idattribute) - Mutable state
- Lifecycle managed by aggregates
- Use stereotypes to mark root entities as Aggregates
- Define clear boundaries for each aggregate
- Model entity relationships using associations
Value Objects
Value objects are immutable objects defined by their attributes rather than identity. Characteristics:- No unique identifier
- Immutable
- Equality based on attribute values
- Use Data Contract elements for value objects
- Add a stereotype to indicate value object semantics
- Avoid associations to entities (use composition instead)
Aggregates
Aggregates are clusters of entities and value objects with defined consistency boundaries. Modeling Approach:- Mark the root entity with an
Aggregatestereotype - Model aggregate members using composition associations
- Define operations on the aggregate root
Metadata API
Accessing Domain Models
Working with Classes
Stereotypes
Designer Settings
The Domain Modeler provides application-level settings:Naming Conventions
Attribute Naming Convention- Options: Manual, Pascal Case, Camel Case
- Default: Manual
- Controls automatic naming when creating/renaming attributes
- Options: Manual, Pascal Case, Camel Case
- Default: Manual
- Controls automatic naming when creating/renaming entities
- Options: Manual, Pascal Case, Camel Case
- Default: Manual
- Controls automatic naming when creating/renaming operations
Common Modeling Scenarios
Modeling an Aggregate
- Create a root entity (e.g.,
Order) - Add the
Aggregatestereotype to mark it as an aggregate root - Create child entities (e.g.,
OrderItem) - Create composition associations from root to children
- Add attributes and operations to the root entity
Modeling Inheritance
- Create a base class (e.g.,
Person) - Create derived classes (e.g.,
Customer,Employee) - Draw generalization arrows from derived to base class
- Add shared attributes to the base class
- Add specific attributes to derived classes
Modeling Relationships
One-to-Many:- Create two entities (e.g.,
CustomerandOrder) - Draw an association from
CustomertoOrder - Set target multiplicity to
0..*or1..*
- Create two entities (e.g.,
StudentandCourse) - Create a junction entity (e.g.,
Enrollment) - Create two one-to-many relationships
Integration with Modules
The Domain Modeler integrates with:- Entity Framework Templates: Generate EF Core entities and DbContext
- Repository Templates: Generate repository patterns
- Domain Events: Model and generate domain event infrastructure
- Validation: Add validation logic through stereotypes
- Mapping: Generate mapping configurations between domain and DTOs
Best Practices
- Start with Aggregates: Identify aggregate boundaries before detailed modeling
- Use Folders: Organize models into logical folders matching bounded contexts
- Leverage Stereotypes: Use stereotypes to add framework-specific metadata
- Model Behavior: Don’t just model data - add operations that represent domain logic
- Keep Diagrams Focused: Create multiple diagrams for different views of the domain
- Use Consistent Naming: Configure naming conventions for consistency
- Document Relationships: Add comments to associations explaining the business meaning
Example Domain Model
A typical e-commerce domain model might include:Related Resources
- Services Modeler - Map domain entities to service DTOs
- Eventing Modeler - Publish domain events