FruitBankHybridApp/docs/ARCHITECTURE.md

56 lines
2.4 KiB
Markdown

# Architecture
## Solution Dependency Graph
```
FruitBank.Common (shared domain)
FruitBank.Common.Server (server-side services, nopCommerce)
FruitBankHybrid.Shared.Common (shared utilities, placeholder)
FruitBankHybrid.Shared (Blazor UI components, pages, services)
↑ ↑ ↑
FruitBankHybrid FruitBankHybrid.Web FruitBankHybrid.Web.Client
(MAUI Hybrid) (Blazor Server) (Blazor WASM)
```
All projects also reference **AyCode.Core** and **AyCode.Blazor** via DLL references (not ProjectReference).
## Three Deployment Targets
| Target | Project | How UI Runs |
|---|---|---|
| **MAUI Hybrid** | FruitBankHybrid | Native app with BlazorWebView |
| **Blazor Server** | FruitBankHybrid.Web | Server-side rendering + SignalR |
| **Blazor WASM** | FruitBankHybrid.Web.Client | Downloaded to browser, runs in WASM |
All three share the same UI components from `FruitBankHybrid.Shared`.
## Data Flow
```
User → DevExpress Grid → AcSignalRDataSource → SignalR (AcBinary) → DevAdminSignalRHub
DynamicMethodRegistry
IFruitBankDataControllerServer
ICustomOrderSignalREndpointServer
IStockSignalREndpointServer
nopCommerce Database
```
## Key Architectural Decisions
- **nopCommerce plugin** — Customer, Order, Product are nopCommerce entities extended via GenericAttributes and DTOs
- **SignalR over REST** — all data flows through SignalR with AcBinary protocol
- **DevExpress Blazor 25.1.3** — exclusive UI component library
- **Three measurement hierarchies** — Shipping/Order/StockTaking share same base but have different audit rules
- **Client-side database** — `DatabaseClient` caches entities in ConcurrentDictionary for offline/fast access
- **Platform-specific credential storage** — MAUI uses SecureStorage, Web uses obfuscated localStorage, Server uses no-op
---
> **LLM Maintenance:** If you modify the architecture, update this document.