How neozhu/razorpagecleanarchitecture works
This is a .NET 9 Razor Pages administration application built around Clean Architecture. Users work through the SmartAdmin UI to manage customers, documents and document types, invoices, approval data, key-values, audit trails, and logs; invoice upload/OCR and approval workflows add domain-specific processing. Application query handlers expose filtered, paginated, and export operations, while infrastructure provides persistence, identity, and file/Excel services. The excerpts show query-to-service and query-to-context calls; many UI routes and unsampled subsystems are represented at directory level, with unverified links omitted or dashed.
Main entry points: Index.cshtml.cs Razor Pages UI · Interfaces Application services · Invoices Invoice operations · ApplicationDbContext.cs Application database
Components 22
Web and identity
- Razor Pages UI
src/SmartAdmin.WebUI/Pages/Customers/Index.cshtml.cs - Identity pages
src/SmartAdmin.WebUI/Areas/Identity/Pages/Account/Login.cshtml.cs - Identity endpoints
src/SmartAdmin.WebUI/EndPoints/IdentityEndpoint.cs
Application capabilities
- Customer operations
src/Application/Customers - Document operations
src/Application/Documents - Document types
src/Application/DocumentTypes - Invoice operations
src/Application/Invoices - Invoice OCR
src/Application/Invoices/PaddleOCR/InvoicesOcrJob.cs - Approval workflow
src/Application/Workflow/Approval/DocmentApprovalWorkflow.cs - Approval records
src/Application/Features/ApprovalDatas - Key-value management
src/Application/KeyValues - Audit and logs
src/Application/Features/AuditTrails - Application services
src/Application/Common/Interfaces
Domain model
- Business entities
src/Domain/Entities/Invoice.cs - Domain events
src/Domain/Events/InvoiceCreatedEvent.cs
Infrastructure
- Application database
src/Infrastructure/Persistence/ApplicationDbContext.cs - Identity service
src/Infrastructure/Services/Identity/IdentityService.cs - File uploads
src/Infrastructure/Services/UploadService.cs - Excel service
src/Infrastructure/Services/ExcelService.cs - Exception middleware
src/Infrastructure/Middlewares/ExceptionHandlerMiddleware.cs - Mail delivery
src/Infrastructure/Services/SMTPMailService.cs
Other components
- Administrator
Connections 32
- Administrator → Razor Pages UI: uses
- Administrator → Identity pages: signs in
- Razor Pages UI → Customer operations: dispatches requests
- Razor Pages UI → Document operations: dispatches requests
- Razor Pages UI → Document types: dispatches requests
- Razor Pages UI → Invoice operations: dispatches requests
- Razor Pages UI → Approval records: dispatches requests
- Razor Pages UI → Key-value management: dispatches requests
- Razor Pages UI → Audit and logs: dispatches requests
- Identity pages → Identity endpoints: uses identity
- Identity endpoints → Identity service: calls
- Customer operations → Application database: queries customers
src/Application/Customers/Queries/PaginationQuery/CustomersWithPaginationQuery.cs - Customer operations → Application services: uses contracts
src/Application/Customers/Queries/Export/ExportCustomersQuery.cs - Customer operations → Excel service: exports workbook
src/Application/Customers/Queries/Export/ExportCustomersQuery.cs - Document operations → Application database: queries documents
src/Application/Documents/Queries/Export/ExportCustomersQuery.cs - Document operations → Application services: uses contracts
src/Application/Documents/Queries/Export/ExportCustomersQuery.cs - Document operations → Excel service: exports workbook
src/Application/Documents/Queries/Export/ExportCustomersQuery.cs - Invoice operations → Application database: queries invoices
src/Application/Invoices/Queries/Export/ExportInvoicesQuery.cs - Invoice operations → Application services: uses contracts
src/Application/Invoices/Queries/Export/ExportInvoicesQuery.cs - Invoice operations → Excel service: exports workbook
src/Application/Invoices/Queries/Export/ExportInvoicesQuery.cs - Invoice operations → Invoice OCR: schedules OCR
- Invoice operations → File uploads: stores attachments
- Approval records → Approval workflow: advances workflow
- Application services → Application database: defines context contract
- Application database → Business entities: persists entities
- Business entities → Domain events: raises events
- Domain events → Audit and logs: records activity
- Excel service → Application services: implements Excel contract
src/Infrastructure/Services/ExcelService.cs - File uploads → Application services: implements upload contract
src/Infrastructure/Services/UploadService.cs - Identity service → Application services: implements identity contract
src/Infrastructure/Services/Identity/IdentityService.cs - Exception middleware → Application services: reads current user
src/Infrastructure/Middlewares/ExceptionHandlerMiddleware.cs - Application services → Mail delivery: mail integration