70 lines
2.8 KiB
Markdown
70 lines
2.8 KiB
Markdown
# Architecture
|
|
|
|
## Dependency Graph
|
|
|
|
```
|
|
AyCode.Core Solution ../AyCode.Core/AyCode.Core.sln (DLL references)
|
|
↑
|
|
AyCode.Blazor.Models ← AyCode.Blazor.Models.Server
|
|
↑
|
|
AyCode.Blazor.Components ← AyCode.Blazor.Controllers
|
|
↑
|
|
AyCode.Maui.Core (MAUI Hybrid host)
|
|
```
|
|
|
|
**Rule:** UI projects reference AyCode.Core via DLL (not ProjectReference). This separates build graphs.
|
|
**Context:** When a core type is not found in this solution, browse `../AyCode.Core/` for its definition.
|
|
|
|
## How It Works
|
|
|
|
### Blazor Server
|
|
1. **AyCode.Blazor.Components** provides all UI components (grids, card views, forms)
|
|
2. Components use **AcSignalRDataSource** to communicate with server via SignalR
|
|
3. SignalR uses **AcBinaryHubProtocol** for high-performance binary serialization
|
|
4. Grid filters are serialized as **AcExpressionNode** trees
|
|
|
|
### MAUI Hybrid
|
|
1. **AyCode.Maui.Core** hosts Blazor components in a WebView
|
|
2. Same components, same SignalR connection — different host
|
|
3. Platform-specific code in `Platforms/` folders (Android, iOS, Windows)
|
|
|
|
## Data Flow
|
|
|
|
```
|
|
User → DxGrid → AcSignalRDataSource → SignalR (AcBinary) → Server Hub → DAL → Database
|
|
↓
|
|
User ← DxGrid ← AcSignalRDataSource ← SignalR (AcBinary) ← Server Hub
|
|
```
|
|
|
|
## MgGrid Component System
|
|
|
|
The primary UI pattern for data screens. Full documentation: [`MGGRID.md`](MGGRID.md)
|
|
|
|
```
|
|
DxGrid (DevExpress)
|
|
└── MgGridBase<TSignalRDataSource, TDataItem, TId, TLoggerClient>
|
|
└── [Project adapter, e.g. FruitBankGridBase<TDataItem>]
|
|
└── [Concrete grid, e.g. GridShippingBase]
|
|
```
|
|
|
|
| Component | Role |
|
|
|---|---|
|
|
| **MgGridBase** | Abstract base — SignalR CRUD, layout persistence, master-detail, edit state |
|
|
| **MgGridWithInfoPanel** | `DxSplitter` wrapper — grid + collapsible InfoPanel + fullscreen |
|
|
| **MgGridToolbarBase** | `DxToolbar` with grid reference and refresh action |
|
|
| **MgGridDataColumn** | `DxGridDataColumn` with URL template support |
|
|
| **MgGridInfoPanel** | Default InfoPanel — column-value display with edit mode |
|
|
|
|
Key behaviors:
|
|
- CRUD via **SignalR message tags** (`SignalRCrudTags`) — not REST
|
|
- **Layout auto-persistence** to `localStorage` (per-user, per-grid, per-master/detail)
|
|
- **Master-detail** via `CascadingParameter<IMgGridBase>`
|
|
- **New item IDs**: negative ints (client-side temp) or `Guid.NewGuid()`
|
|
|
|
## Key Design Decisions
|
|
|
|
- **DevExpress 25.1.3** exclusively — no mixing with other component libraries
|
|
- **SignalR over REST** for grid data — enables real-time updates and binary protocol
|
|
- **Expression serialization** — grid filters evaluated server-side, not client-side
|
|
- **Shared components** — Blazor Server and MAUI Hybrid use the exact same component library
|