How ezzylearning/ai_agents_in_csharp_dotnet works
Northwind.Api exposes an order-support chat endpoint. A customer submits a message, the controller invokes the support-agent abstraction, and the Ollama-backed agent can use order tools to retrieve status or delivery information from the SQL-backed order store. The graph also shows the domain and persistence mapping layer. Evidence is limited to the supplied excerpts and SOURCE INDEX; startup wiring and some subsystem behavior are not shown, so unsupported links are omitted.
Main entry points: DependencyInjection.cs Infrastructure registration · NorthwindDbContext.cs EF database context · OllamaAgentFactory.cs Agent factory · SupportController.cs Support endpoint
Components 15
API entry
- Support endpoint
Northwind.Api/Controllers/SupportController.cs
AI support
- Support contract
Northwind.Application/AI/Agents/ICustomerSupportAgent.cs - Ollama agent
Northwind.Infrastructure/AI/Agents/Ollama/OllamaCustomerSupportAgent.cs - Agent factory
Northwind.Infrastructure/AI/Agents/Ollama/OllamaAgentFactory.cs - Order tools
Northwind.Infrastructure/AI/Tools/OrderTools.cs
Order domain
- Order repository contract
Northwind.Domain/Orders/IOrderRepository.cs - Order queries
Northwind.Infrastructure/Orders/OrderRepository.cs - Order entity
Northwind.Domain/Orders/Order.cs
Persistence
- Database contract
Northwind.Application/Data/IApplicationDbContext.cs - EF database context
Northwind.Infrastructure/Data/NorthwindDbContext.cs - Order mapping
Northwind.Infrastructure/Orders/OrderConfigurations.cs - Infrastructure registration
Northwind.Infrastructure/DependencyInjection.cs
Other components
- Customer
- Ollama model
- SQL database
Connections 23
- Customer → Support endpoint: submits message
Northwind.Api/Controllers/SupportController.cs - Support endpoint → Support contract: asks agent
Northwind.Api/Controllers/SupportController.cs - Support endpoint → Customer: returns response
Northwind.Api/Controllers/SupportController.cs - Ollama agent → Support contract: implements
Northwind.Infrastructure/AI/Agents/Ollama/OllamaCustomerSupportAgent.cs - Ollama agent → Agent factory: creates agent
Northwind.Infrastructure/AI/Agents/Ollama/OllamaCustomerSupportAgent.cs - Agent factory → Order tools: registers tools
Northwind.Infrastructure/AI/Agents/Ollama/OllamaAgentFactory.cs - Agent factory → Ollama model: creates client
Northwind.Infrastructure/AI/Agents/Ollama/OllamaAgentFactory.cs - Order tools → Order repository contract: requests order data
Northwind.Infrastructure/AI/Tools/OrderTools.cs - Order queries → Order repository contract: implements
Northwind.Infrastructure/Orders/OrderRepository.cs - Order queries → Database contract: queries orders
Northwind.Infrastructure/Orders/OrderRepository.cs - EF database context → Database contract: implements
Northwind.Infrastructure/Data/NorthwindDbContext.cs - EF database context → Order entity: exposes orders
Northwind.Infrastructure/Data/NorthwindDbContext.cs - EF database context → Order mapping: applies mappings
Northwind.Infrastructure/Data/NorthwindDbContext.cs - Order mapping → Order entity: maps fields
Northwind.Infrastructure/Orders/OrderConfigurations.cs - Infrastructure registration → EF database context: registers context
Northwind.Infrastructure/DependencyInjection.cs - Infrastructure registration → Database contract: binds context
Northwind.Infrastructure/DependencyInjection.cs - Infrastructure registration → Order queries: registers repository
Northwind.Infrastructure/DependencyInjection.cs - Infrastructure registration → Order repository contract: binds repository
Northwind.Infrastructure/DependencyInjection.cs - Infrastructure registration → Order tools: registers tools
Northwind.Infrastructure/DependencyInjection.cs - Infrastructure registration → Agent factory: registers factory
Northwind.Infrastructure/DependencyInjection.cs - Infrastructure registration → Ollama agent: binds agent
Northwind.Infrastructure/DependencyInjection.cs - Infrastructure registration → SQL database: configures SQL
Northwind.Infrastructure/DependencyInjection.cs - EF database context → SQL database: accesses store