Before starting, ensure you have installed Intent Architect and the .NET SDK (6.0 or later).
What We’ll Build
We’ll create a Product Catalog API with:- RESTful endpoints for managing products
- CQRS pattern using MediatR
- Entity Framework Core for data persistence
- SQL Server database
- Complete CRUD operations
This tutorial takes approximately 15 minutes to complete.
Create a New Solution
Create New Solution
- Click Create New Solution on the welcome screen
- Enter solution name:
ProductCatalog - Choose a location for your solution
- Click Create
Select Application Template
Intent Architect will prompt you to select an application template:
- Choose Clean Architecture with ASP.NET Core
- Configure the application:
- Application Name:
ProductCatalog - API Type: ASP.NET Core Web API
- CQRS Pattern: MediatR
- Database Provider: SQL Server
- ORM: Entity Framework Core
- Application Name:
- Click Create Application
Understand the Solution Structure
Intent Architect creates a solution with the following structure:You’ll work primarily in the visual designers within Intent Architect. The C# projects will be generated automatically.
Model Your Domain
Let’s create a Product entity using the Domain Designer.Open Domain Designer
- In Intent Architect, double-click Domain in the solution explorer
- This opens the Domain Designer canvas
Add Attributes
Right-click on the
Product class and select Add Attribute for each property:| Name | Type | Required |
|---|---|---|
| Name | string | ✓ |
| Description | string | ✓ |
| Price | decimal | ✓ |
| StockQuantity | int | ✓ |
| Sku | string | ✓ |
| IsActive | bool | ✓ |
Configure the Sku Attribute
Let’s add a database index to the Sku field:
- Right-click on the
Skuattribute - Select Apply Stereotype → Index
- In the stereotype properties:
- Set Is Unique to
true
- Set Is Unique to
Create Service Operations
Now let’s create the API operations using the Services Designer.Open Services Designer
- In Intent Architect, double-click Services in the solution explorer
- This opens the Services Designer canvas
Add CQRS Operations
Right-click on the
Products service and add these operations:Commands (Create, Update, Delete):- Create Command:
- Right-click → Add Operation → Create
- This creates a
CreateProductcommand - Map the parameters to your Product entity attributes
- Update Command:
- Right-click → Add Operation → Update
- Creates
UpdateProductcommand
- Delete Command:
- Right-click → Add Operation → Delete
- Creates
DeleteProductcommand
- Get By Id Query:
- Right-click → Add Operation → Query
- Name it
GetProductById - Add parameter:
id(guid) - Set return type:
ProductDto
- Get All Query:
- Right-click → Add Operation → Query
- Name it
GetProducts - Set return type:
ProductDto[](collection)
Configure DTOs
Intent Architect automatically creates DTOs (Data Transfer Objects) for your operations.
- Find the
ProductDtoin the Services Designer - Verify it has all the fields from your Product entity
- If not, right-click on an operation and use Map from Domain to automatically create mappings
Install Additional Modules
Let’s ensure we have all necessary modules installed.Verify Core Modules
Ensure these modules are installed (they should be from the template):
- ✓ Intent.AspNetCore - ASP.NET Core hosting
- ✓ Intent.AspNetCore.Controllers - Web API controllers
- ✓ Intent.Application.MediatR - MediatR CQRS
- ✓ Intent.EntityFrameworkCore - Entity Framework Core
- ✓ Intent.EntityFrameworkCore.Repositories - Repository pattern
- ✓ Intent.Entities - Domain entity generation
Configure Module Settings
Open Application Settings
Right-click on your application in the solution explorer and select Settings.
Configure Entity Framework
- Navigate to EntityFrameworkCore → Database Settings
- Configure:
- Database Provider: SQL Server
- Table Naming Convention: Pluralized
- Click Save
Generate Code
Now for the exciting part - generating your application!Run the Software Factory
Click the Run Software Factory button (or press
F5).Intent Architect will:- Generate domain entities
- Generate MediatR commands and queries
- Generate command/query handlers
- Generate API controllers
- Generate Entity Framework DbContext
- Generate repository implementations
- Configure dependency injection
- Set up the application startup
Review Changes
The Software Factory shows all files that will be created or modified.
- Review the changes (expand the tree to see specific files)
- Click Apply Changes
Explore Generated Code
Let’s examine what Intent Architect generated:Domain Entity
ProductCatalog.Domain/Entities/Product.cs
MediatR Command
ProductCatalog.Application/Products/CreateProduct/CreateProductCommand.cs
Command Handler
ProductCatalog.Application/Products/CreateProduct/CreateProductCommandHandler.cs
API Controller
ProductCatalog.Api/Controllers/ProductsController.cs
Create Database Migration
Now let’s create the database schema.Create Migration
Run the Entity Framework migration command:This creates a migration file with your database schema.
Update Connection String
Open
ProductCatalog.Api/appsettings.json and update the connection string:This connection string uses LocalDB. For SQL Server, use:
Server=localhost;Database=ProductCatalog;Integrated Security=true;Run the Application
Test Your API
Let’s test the API using Swagger UI:Create a Product
- In Swagger UI, expand the POST /api/Products endpoint
- Click Try it out
- Enter request body:
- Click Execute
- You should get a
201 Createdresponse with a GUID
Get All Products
- Expand the GET /api/Products endpoint
- Click Try it out → Execute
- You should see your created product in the response
Get Product by ID
- Copy the ID from the previous response
- Expand the GET /api/Products/ endpoint
- Click Try it out
- Paste the ID
- Click Execute
- You should see the product details
Update Product
- Expand the PUT /api/Products/ endpoint
- Click Try it out
- Update the product details (e.g., change the price)
- Click Execute
- You should get a
204 No Contentresponse
Make Changes and Regenerate
Let’s see Intent Architect’s power by adding a new field:Add Category Field
- Switch back to Intent Architect
- Open the Domain Designer
- Right-click on
Product→ Add Attribute - Name:
Category, Type:string, Required: ✓ - Save the model (
Ctrl+S)
Regenerate Code
- Click Run Software Factory (
F5) - Review the changes - Intent Architect updates:
- Product entity
- DTOs
- Commands
- Database migrations
- Click Apply Changes
Notice how Intent Architect updated all related code automatically - entities, DTOs, commands, handlers, and controllers - maintaining consistency throughout your application.
What’s Next?
Add Validation
Add input validation using FluentValidation
Add Authentication
Secure your API with JWT authentication
Domain Events
Implement domain events for decoupled business logic
Explore Modules
Discover more modules to enhance your application
Key Takeaways
Model-Driven Development
You designed your application using visual models (Domain, Services) rather than writing boilerplate code.
Automated Code Generation
Intent Architect generated entities, commands, queries, handlers, controllers, repositories, and configuration automatically.
Pattern Consistency
All generated code follows CQRS, Clean Architecture, and repository patterns consistently.
Change Propagation
When you modified the model (added Category), changes propagated automatically throughout the codebase.
Production-Ready Code
The generated code includes dependency injection, async/await, proper HTTP status codes, and separation of concerns.
Troubleshooting
Software Factory Errors
If the Software Factory shows errors:- Check that all required modules are installed
- Verify module versions are compatible
- Review module settings for configuration issues
- Check the Output window for detailed error messages
Database Connection Issues
Build Errors After Regeneration
-
Clean and rebuild:
-
If issues persist, delete
bin/andobj/folders:
Learn More
Congratulations!
You’ve successfully created your first Intent Architect application with:- ✓ Clean Architecture structure
- ✓ CQRS with MediatR
- ✓ Entity Framework Core
- ✓ RESTful API with ASP.NET Core
- ✓ Swagger documentation
- ✓ Complete CRUD operations
