Updated documentation to include details on the `TBSIG_EMAIL_TEMPLATE` table, its structure, and runtime behavior. Enhanced code by introducing the `IDocument` interface and adding properties/methods to support email templates and document signing workflows. Replaced `int` with the `EnvelopeStatus` enum for improved type safety. Removed unused `Signed` property from `EnvelopeReceiverDto`. Added extension methods for `IDocument` and `IDocReceiverElement` to verify signing status. Updated deployment and troubleshooting guides to highlight email template requirements.
28 KiB
EnvelopeGenerator - Agent Guide
Must Read First
COPILOT_CONTEXT.md- Architecture, coordinate systems, migration statusFORM_APPLICATION_CONTEXT.md- Legacy VB.NET features to migrate
Documentation Catalog
This section explains every markdown file in the repo: what it contains, why it exists, and when you need it. Read this before deciding which file to open.
Core Architecture Docs (Active — Always Relevant)
AGENTS.md ← you are here
What: Authoritative agent/copilot onboarding guide. Covers project structure, route table, render mode rules, coordinate system, API gaps, database/email-template reference, and common mistakes. Why it exists: Single source of truth for agents so they don't re-derive architecture from code on every session. When you need it: Always. Read first on every session. Maintenance: Update whenever project structure, routes, render modes, or naming conventions change.
COPILOT_CONTEXT.md
What: Deep-dive architecture reference. Covers the full Blazor Auto hybrid setup, authentication flows (JWT + cookies, per-envelope receiver tokens), service registration patterns, coordinate system proof, and an explicit "prefer Server/Server.Client over old WebUI/ReceiverUI" rule. Why it exists: Prevents agents from re-deriving or misinterpreting the hybrid SSR+WASM architecture. Also documents coordinate system evidence to prevent regressions (inches vs. points vs. pixels). When you need it:
- Implementing any new page or service
- Debugging auth/cookie issues
- Any coordinate conversion question
- Unsure which project a new file should go in Maintenance: Update when render mode assignments change, new auth schemes are added, or the coordinate system is touched.
FORM_APPLICATION_CONTEXT.md
What: Comprehensive reverse-engineering of the legacy VB.NET WinForms app (EnvelopeGenerator.Form). Documents every form (frmMain, frmEnvelopeEditor, frmFieldEditor, etc.), their UI layout, toolbar actions, data models, coordinate system, and a feature-by-feature migration mapping table to EnvelopeGenerator.Server.
Why it exists: The WinForms app is the functional specification for the sender-side web UI. It documents the full intended workflow that is being migrated to Blazor — especially the envelope creation, signature field placement, and dashboard features that are not yet implemented.
When you need it:
- Implementing any sender-side feature (
/sender,/sender/editor,/sender/envelope/{id}) - Understanding what a specific toolbar button or form should do
- Designing API endpoints for sender workflow
- Checking coordinate system behavior (INCHES proof is here)
Maintenance: Update the mapping table as features are implemented (change
❌ Not implemented→✅ Exists). Do not renameReceiverUIback — it was the old project name; current target isEnvelopeGenerator.Server.
RECEIVER_PDF_VIEWER_CONTEXT.md
What: Detailed technical reference for the receiver-side PDF viewer (EnvelopeReceiverPage.razor). Documents the PDF.js integration, signature button rendering, JS interop API (window.pdfViewer), signature capture flow, HiDPI/zoom/thumbnail config, and the full component lifecycle.
Why it exists: The receiver PDF viewer is the most complex component in the codebase. This doc prevents agents from misunderstanding the JS↔Blazor boundary, re-implementing already-solved problems (HiDPI, zoom, signature caching), or breaking the signing flow.
When you need it:
- Working on
EnvelopeReceiverPage.razororpdf-viewer.js - Adding new signature field rendering logic
- Debugging signature rendering, zoom, or thumbnail issues
- Implementing sender-side PDF.js overlay (signature field placement) — the receiver side is the reference implementation
Maintenance: Update when
pdf-viewer.jsAPI changes, new JS interop functions are added, or the signing flow is modified.
DATABASE_STRUCTURE_CONTEXT.md
What: Deep DB documentation for the envelope domain. Includes table/column snapshot, entity-to-table mapping, EF relationship/constraint map, stored procedure behavior + call sites, and trigger behavior + wiring path. Why it exists: DB is centralized and can evolve independently; this file preserves migration-critical data semantics when historical DB context is hard to recover. When you need it:
- Planning or reviewing DB/schema changes
- Debugging status transitions/history side effects
- Tracing where
PRSIG_*procedures or DB triggers affect app behavior - Reconciling Domain entities with physical SQL schema Maintenance: Refresh on each DB migration, trigger/procedure change, or significant Domain/EGDbContext model change.
Deployment Docs
EnvelopeGenerator.Server/EnvelopeGenerator.Server/README.md
What: IIS publish and deployment guide for EnvelopeGenerator.Server. Covers why self-contained publish is required (WASM assembly version strictness), the exact dotnet publish command, IIS Application Pool settings (No Managed Code), directory structure after publish, common deployment errors, and the email-template table (TBSIG_EMAIL_TEMPLATE) that must exist in the target DB.
Why it exists: Blazor Auto (Server + WASM hybrid) has non-obvious deployment requirements that differ from a standard ASP.NET Core app. Forgetting self-contained publish or using the wrong app pool will break WASM loading in production.
When you need it:
- Deploying to IIS for the first time
- Troubleshooting 500 errors on production after deploy
- Setting up a new deployment environment Maintenance: Update if the publish target, IIS config, or runtime version changes.
Markdown Audit Snapshot (2026-10-05)
The following table summarizes repository markdown files by practical status: completed, partially complete, or removable candidates.
| File | Type | Status | Missing / Gap | Removal Recommendation |
|---|---|---|---|---|
AGENTS.md |
Agent onboarding | Partially complete | Route/migration statements can drift from real code over time. | Keep |
COPILOT_CONTEXT.md |
Architecture reference | Partially complete | Some route/render details may be out of sync with other docs; needs regular reconciliation. | Keep |
FORM_APPLICATION_CONTEXT.md |
Legacy-to-modern feature spec | Partially complete | Large sections still marked not implemented / needs implementation. | Keep |
RECEIVER_PDF_VIEWER_CONTEXT.md |
Receiver PDF viewer deep-dive | Partially complete | Long migration plan needs periodic sync with active implementation. | Keep |
SENDER_SAVE_EDIT_MIGRATION_PLAN.md |
Sender workflow implementation plan | Partially complete | No explicit implementation progress markers per phase. | Keep (until migration closes) |
SENDER_PDF_TOOLBAR_PLAN_EN.md |
Sender PDF toolbar plan | Incomplete | Explicit pending item remains (Toolbar visual polish). |
Keep (until done) |
SENDER_EDITOR_WASM_PDF_EDITOR_IMPLEMENTATION_PLAN_en.md |
Sender editor WASM migration plan | Incomplete | Plan exists but completion/progress tracking is minimal. | Keep (until done) |
EnvelopeGenerator.Server/EnvelopeGenerator.Server/README.md |
Deployment guide | Complete (operational) | No critical gap identified. | Keep |
envelope-generator-ui/README.md |
Angular scaffold README | Complete but generic | Template text only; low project-specific value. | Removable or replace with project-specific summary |
EnvelopeGenerator.Web/wwwroot/lib/typed.js@2.1.0/README.md |
Third-party vendor README | Complete (vendor) | Not project workflow documentation. | Keep with vendor assets |
EnvelopeGenerator.Web/wwwroot/lib/jquery-validation/LICENSE.md |
Third-party license | Complete (legal) | No gap. | Keep |
EnvelopeGenerator.Server/EnvelopeGenerator.Server/wwwroot/css/open-iconic/README.md |
Third-party vendor README | Complete (vendor) | Not project-specific guidance. | Keep with vendor assets |
ignore/EnvelopeGenerator/EnvelopeGenerator.Web/wwwroot/README.md |
Legacy PSPDFKit note | Outdated | Mentions deprecated PSPDFKit-based flow; may mislead if reused. | Removable/archive |
ignore/EnvelopeGenerator/EnvelopeGenerator.Web/wwwroot/lib/typed.js@2.1.0/README.md |
Duplicate vendor README | Redundant | Duplicate copy under ignore/. |
Removable/archive |
ignore/EnvelopeGenerator/EnvelopeGenerator.Web/wwwroot/lib/bootstrap-icons/README.md |
Vendor README in archive area | Secondary | Archive-only utility, not active docs. | Removable/archive |
ignore/EnvelopeGenerator/EnvelopeGenerator.Web/wwwroot/lib/jquery-validation/LICENSE.md |
Duplicate license in archive area | Redundant | Duplicate copy under ignore/. |
Removable/archive (if legal policy allows) |
ignore/EnvelopeGenerator/EnvelopeGenerator.GeneratorAPI/ClientApp/envelope-generator-ui/README.md |
Duplicate Angular scaffold README | Redundant | Generic template + duplicate in archive path. | Removable/archive |
Documentation Audit TODO
- Validate this markdown audit table against the current codebase and update statuses (
complete,partial,incomplete,removable) when implementation changes land.
Active Architecture (Post-Migration)
Frontend: Blazor Auto (Server+WASM hybrid)
- EnvelopeGenerator.Server (Server):
@rendermode InteractiveServer- PDF viewers requiring DevExpress backend - EnvelopeGenerator.Server.Client (WASM):
@rendermode InteractiveWebAssembly- Login, dashboards, business logic
Backend + API Host: EnvelopeGenerator.Server (ASP.NET Core 8.0, merged Blazor + Web API host)
Proxy: YARP in EnvelopeGenerator.Server is used for external integrations (for example AuthHub forwarding), not for routing app APIs to EnvelopeGenerator.API.
Deprecated Projects - DO NOT USE
EnvelopeGenerator.ReceiverUI- Pure WASM (migrated to Server)EnvelopeGenerator.Web- Razor Pages (replaced by Server)- VB.NET projects (
Form,Service,BBTests) - Legacy, read-only for reference
Development Commands
Run Active Host
# Terminal - Blazor + Web API host
cd EnvelopeGenerator.Server\EnvelopeGenerator.Server
dotnet run
Critical: EnvelopeGenerator.Server is the active runtime host for both UI and API controllers.
Build
dotnet build EnvelopeGenerator.sln
Project Boundaries
EnvelopeGenerator.Domain/ # Entities (Envelope, Receiver, Document, etc.)
EnvelopeGenerator.Application/ # MediatR CQRS (Commands, Queries, Handlers)
EnvelopeGenerator.Infrastructure/ # EF Core, SQL executors, repositories
EnvelopeGenerator.Server/
EnvelopeGenerator.Server/ # Server-side Blazor + API controllers
├─ Components/Pages/ # @rendermode InteractiveServer
├─ Controllers/ # Active Web API endpoints
EnvelopeGenerator.Server.Client/ # Client-side WASM components
├─ Pages/ # @rendermode InteractiveWebAssembly
├─ Services/ # HTTP API clients
├─ Models/ # DTOs
Route Structure (Critical)
| Route | File Location | Render Mode | Purpose |
|---|---|---|---|
/ |
Server.Client/Pages/Index.razor |
WASM | Landing page |
/sender/login |
Server.Client/Pages/LoginSenderPage.razor |
WASM | Sender auth |
/sender |
Server/Components/Pages/EnvelopeSenderPage.razor |
Server | Sender dashboard |
/sender/editor |
Server/Components/Pages/EnvelopeSenderEditorPage.razor |
Server | Envelope editor + PDF viewer |
/envelope/login/{key} |
Server.Client/Pages/LoginReceiverPage.razor |
WASM | Receiver auth |
/envelope/{key} |
Server/Components/Pages/EnvelopeReceiverPage.razor |
Server | PDF viewer + signing |
Rule: PDF viewers MUST use @rendermode InteractiveServer (DevExpress backend requirement). Everything else uses WASM.
Coordinate System (CRITICAL)
Database stores INCHES (GdPicture14 native). Origin: top-left, Y-axis down.
Conversions
// Database (INCHES) → PDF Points
float points = inches * 72;
// Database (INCHES) → DevExpress DX
float dx = inches * 100;
// PDF.js Pixels → Database (INCHES)
float inches = (pixelX / canvasWidth) * pageWidthInches;
A4 Page: 8.27" wide × 11.69" tall = 595pt × 842pt
Signature Field Size: 1.77" × 1.96" (FIXED, do not change)
Evidence: See COPILOT_CONTEXT.md lines 158-185, EnvelopeGenerator.Form/frmFieldEditor.vb
API Architecture Quirks
Monolithic Endpoint (Avoid for UI)
POST /api/EnvelopeReceiver - Creates envelope+document+receivers+fields atomically.
- Use case: External API consumers
- Not suitable for: Step-by-step UI workflow (no draft support, no partial updates)
Sender Workflow Endpoint
POST /api/Envelope # Create/update/save/send envelope workflow payload
DELETE /api/Envelope/{id} # Delete with reason
POST /api/Envelope/{id}/document # Upload PDF
POST /api/Envelope/{id}/receivers # Add receiver
POST /api/Envelope/{id}/signature-fields # Place signature field
See FORM_APPLICATION_CONTEXT.md for detailed workflow requirements.
Status Color Coding
Form app uses DevExpress CustomDrawCell. EnvelopeGenerator.Server needs CSS:
.envelope-row.status-partly-signed { background-color: #81C784; } /* GREEN_300 */
.envelope-row.status-queued,
.envelope-row.status-sent { background-color: #FFB74D; } /* ORANGE_300 */
.envelope-row.status-completed { background-color: #81C784; }
.envelope-row.status-deleted,
.envelope-row.status-rejected { background-color: #E57373; } /* RED_300 */
Configuration
YARP Proxy (EnvelopeGenerator.Server/yarp.json)
Routes /api/*, /swagger/*, /openapi/*, /scalar/* → https://localhost:8088
PDF.js Settings (EnvelopeGenerator.Server/wwwroot/appsettings.json)
{
"PdfViewerOptions": {
"ThumbnailBaseScale": 0.75,
"ThumbnailEnableHiDPI": true,
"MainCanvasEnableHiDPI": true,
"ZoomStepPercentage": 5
}
}
Server Host Config (EnvelopeGenerator.Server/EnvelopeGenerator.Server/appsettings.json)
ConnectionStrings:Default- SQL Server DBAllowedOrigins- CORS (includeshttp://localhost:5131,http://localhost:7192)Cache:SignatureCacheExpiration- Signature persistence timeoutPSPDFKitLicenseKey- DEPRECATED (use PDF.js instead)
Migration Status
Complete ✅
- Receiver login/authentication
- PDF viewing with PDF.js (HiDPI, zoom, thumbnails)
- Signature capture (draw/type/image)
- Signature caching (Redis/SQL)
- Sender login
Missing (High Priority) ❌
- Sender dashboard (
/sender) - Empty stub - Envelope editor (
/sender/envelope/{id}) - Signature field placement tool (PDF.js + draggable overlays)
- Granular API endpoints (draft, receivers, fields)
- Master-detail grids for receivers/history
Common Mistakes (DO NOT REPEAT)
| Mistake | Why Wrong |
|---|---|
| Using iText7 in receiver pages | GPL license issue. Use PDF.js overlays. |
| Using PSPDFKit | Removed from architecture. Use PDF.js + DevExpress. |
@rendermode InteractiveWebAssembly on PDF viewers |
DevExpress DxPdfViewer requires server-side rendering. |
| Hardcoded quality in PDF.js | Use appsettings.json PdfViewerOptions. |
| Coordinates in points/pixels for DB | Database uses INCHES. Convert before save. |
BottomMarginBand for signatures |
Repeats on every page. Use DetailBand. |
Testing
No automated tests exist yet.
Manual testing workflow:
- Start EnvelopeGenerator.Server (
dotnet runinEnvelopeGenerator.Server\EnvelopeGenerator.Server) - Navigate to
https://localhost:5131(or check console output for port) - Test sender login at
/sender/login - Test receiver flow at
/envelope/login/{envelopeKey}
Technical Debt TODOs
- CRITICAL (Licensing / pre-commercial release): Remove all
SixLabors.ImageSharpandQRCoder-ImageSharppackage dependencies from production/runtime projects before commercial release. Replace remaining QR/image paths with permissive-license alternatives (no copyleft/share-source obligations), run repo-wide package audit (*.csproj), and add CI guardrails to block reintroduction. - Refactor
EnvelopeGenerator.Server/EnvelopeGenerator.Server/Components/Pages/EnvelopeSenderPage.razorto reduce complexity. - Move sender dashboard business/status logic into dedicated services and extension methods (for example effective status resolution, tab classification, receiver signed/rejected detection, and grid-layout filter sanitation).
- Keep
EnvelopeSenderPage.razorfocused on UI composition/state orchestration; avoid embedding heavy domain logic directly in the Razor component. - Apply a modular page architecture across Server pages (starting with
EnvelopeGenerator.Server/EnvelopeGenerator.Server/Components/Pages/EnvelopeSenderPage.razor): split large pages into smaller subcomponents/partial modules, eliminate duplicated code paths, and centralize shared UI/domain logic for maintainability. - Perform a senior-level page performance review across sender/receiver flows before further UX changes: verify route transitions, component mount/unmount behavior, loading-state correctness, duplicate API calls, and perceived latency (first meaningful paint and return-navigation responsiveness). Treat loading logic defects as architecture/performance issues first, not styling problems.
- Audit
EnvelopeGenerator.Server/EnvelopeGenerator.Server.Client/Services/for unnecessary request/payload remapping and remove redundant mappings where direct request DTO usage is safe; review client HTTP methods end-to-end for similar avoidable transformation layers. - Centralize dependency injection registrations into dedicated extension methods/modules (especially server + client service registrations in
Program.cs) to reduce startup composition sprawl and improve maintainability. - Refactor
EnvelopeGenerator.Server/EnvelopeGenerator.Server/Controllers/PdfRenderController.cs+ matching client service contract to remove JSON/base64byte[]transport for PDF rendering; prefer binary streaming (application/octet-streamor multipart), avoiddata:URL bloat where possible, and validate end-to-end memory/latency behavior with large PDFs. - Move sender PDF image editor initial zoom from hardcoded value to Options pattern configuration (bind from
appsettings.jsonand inject viaIOptions/IOptionsMonitor) so default zoom (for example%180) is environment-configurable. - Establish a DevExpress toast-based notification architecture using
DxToastProvider+IToastNotificationService(tab/page-scoped provider strategy, standardizedToastOptionsfactory, and severity-to-style mapping) so sender/receiver flows show consistent, non-duplicated, actionable feedback. - Eliminate manual property-by-property request→domain mapping drift (example:
CreateEnvelopeCommandHandler) by introducing a standardized mapping policy (AutoMapper/profile conventions or reflection/source-generator based mapper) and enforcing it across envelope workflows; this needs to be solved in the shared company Core library level so all services get the same guardrails by default. - P1 security workstream: remove dynamic SQL string composition/interpolation from active save/create/update paths (
string.Format,$"...{input}...",ToSqlParam) and migrate to parameterized queries only; treat this as a potential SQL injection vulnerability (stability + security risk), execute repo-wide audit, and add CI guardrails to block reintroduction. - Alternative UX design (Server component): in
EnvelopeGenerator.Server/EnvelopeGenerator.Server/Components/Pages/EnvelopeSenderPage.razor, enforce deterministic row double-click behavior as exactly one action (preview OR edit), and keep row action buttons/tooltips aligned with the same rule to eliminate ambiguous navigation. - Implement SPA-style language switching so the UI culture updates immediately without a full page reload.
- Implement sender-scoped caching for "recent receiver suggestions" used during envelope creation (wizard/editor flows): cache key should include sender identity, support short TTL + invalidation hooks after successful envelope receiver writes, and prevent cross-sender suggestion leakage.
Database
SQL Server (DD_ECM)
- Connection string in
EnvelopeGenerator.Server/EnvelopeGenerator.Server/appsettings.json - EF Core migrations NOT used (manual SQL scripts)
- Stored procedures:
PRSIG_*prefix
Key Tables:
TBSIG_ENVELOPE- Envelope metadataTBSIG_ENVELOPE_RECEIVER- Receiver assignmentsTBSIG_DOCUMENT_RECEIVER_ELEMENT- Signature fields (X, Y in INCHES)TBSIG_RECEIVER- Receiver registryTBSIG_ENVELOPE_DOCUMENT- PDF binary dataTBSIG_ENVELOPE_HISTORY- Audit trailTBSIG_EMAIL_TEMPLATE- Notification mail templates (HTML,de-DE, placeholder tokens)
Email Templates (TBSIG_EMAIL_TEMPLATE)
All notification mails are rendered from dbo.TBSIG_EMAIL_TEMPLATE (GUID, NAME, SUBJECT, BODY, LANG_CODE, ADDED_WHEN, CHANGED_WHEN). Current data: 10 rows, all de-DE, HTML bodies sharing one layout (600px card, gradient header, [NAME_PORTAL] branding). Templates are resolved by NAME (EmailTemplateType), never by GUID; GUIDs 7 and 8 are unused.
| GUID | NAME |
Purpose | Recipient |
|---|---|---|---|
| 1 | DocumentReceived |
"[NAME_SENDER] sent you a document to [SIGNATURE_TYPE]" + document link, optional [MESSAGE] |
Every receiver on envelope creation (CreateEnvelopeCommandHandler) |
| 2 | DocumentDeleted |
Envelope deleted/withdrawn by sender, includes [REASON] |
Receivers (EnvelopeDeletedNotification) |
| 3 | DocumentSigned |
Confirms successful signing/confirmation ([FINAL_STATUS], [RECEIVER_ACTION]) |
The acting receiver (SendSignedMailBehavior, FinalizeEnvelopeCommand) |
| 4 | DocumentCompleted |
Envelope completed; finished document + result report attached | Receivers (payload exists, no active dispatch in repo) |
| 5 | DocumentAccessCodeReceived |
Access code ([DOCUMENT_ACCESS_CODE]) for viewing/signing |
The receiver (SendAccessCodeCommand) |
| 6 | DocumentRejected_ADM |
A receiver rejected the envelope, includes [REASON] |
Sender/ADM |
| 9 | DocumentRejected_REC |
Confirms the rejection; "sender was informed" | The rejecting receiver |
| 10 | DocumentRejected_REC_2 |
"Another party rejected; sender will contact you if needed" | All other receivers |
| 11 | DocumentShared |
"[NAME_RECEIVER] shared a document for viewing" + link | The newly shared (read-only) recipient (ReadOnlyController) |
| 12 | TotpSecret |
2FA QR code ([TFA_QR_CODE]), valid until [TFA_EXPIRATION] |
The receiver (TFA registration, TfaRegistrationController) |
Key placeholders: [NAME_PORTAL], [NAME_SENDER], [NAME_RECEIVER], [DOCUMENT_TITLE], [LINK_TO_DOCUMENT], [REASON], [SIGNATURE_TYPE], [FINAL_STATUS], [FINAL_ACTION], [DOCUMENT_ACCESS_CODE], [TFA_QR_CODE], [TFA_EXPIRATION]. Defaults for [NAME_PORTAL], [SIGNATURE_TYPE] and [REASON] come from MailParams:Placeholders in appsettings.json; the rest are filled at send time (EnvelopeMailService / notification payloads).
Notes:
- Actively dispatched in this repo: 1, 2, 3, 5, 11. Templates 4, 6, 9, 10, 12 have notification payloads in
Application/Common/Interfaces/Services/Notification/but no in-reponew ...Notificationcall — assume the legacy Form app or DB-side automation dispatches them. - Templates are runtime data, not code: they must exist in the target DB. A missing template makes
EnvelopeMailServicelog aDataIntegrityIssueand skip the mail. - Edit via
UpdateEmailTemplateCommand; reset-to-default values live inResetEmailTemplateCommand. DB triggerTBSIG_EMAIL_TEMPLATE_AFT_UPDis registered throughDbTriggerParams.EmailTemplate. - Do not change
GUIDs — lookup is byNAME, but downstream tooling/reporting may key on the ID.
Data Structure (Domain + EGDbContext)
Use this as the canonical quick map before touching sender/receiver workflow code.
Core Aggregate Shape
Envelope(TBSIG_ENVELOPE) is the root aggregate for sending workflow.Envelope -> Documentsis1:NviaDocument.EnvelopeId(TBSIG_ENVELOPE_DOCUMENT).Envelope -> Historiesis1:NviaHistory.EnvelopeId(TBSIG_ENVELOPE_HISTORY).Envelope <-> ReceiverisN:NthroughEnvelopeReceiver(TBSIG_ENVELOPE_RECEIVER, composite PK{EnvelopeId, ReceiverId}).Document -> DocReceiverElementis1:NviaDocReceiverElement.DocumentId(TBSIG_DOCUMENT_RECEIVER_ELEMENT).DocReceiverElement -> ElementAnnotationis1:NviaElementAnnotation.ElementId(TBSIG_DOCUMENT_RECEIVER_ELEMENT_ANNOTATION).
Status and Tracking Entities
DocumentStatus(TBSIG_DOCUMENT_STATUS) linksEnvelopeId + ReceiverIdand stores receiver-level signing state.Historystores timeline events (EnvelopeStatus) with polymorphicUserReferencelookup semantics.EnvelopeReceiverReadOnly(TBSIG_ENVELOPE_RECEIVER_READ_ONLY) stores temporary read-only delegation with validity window (DateValid).
Important Constraints From EGDbContext
Envelope.Uuidhas a unique index.Receiver.Signaturehas a unique index.Receiver.EmailAddresshas a unique index.EnvelopeReceiveruses composite primary key:{ EnvelopeId, ReceiverId }.History.UserReferenceis mapped conditionally (IsMigration == false) to:Receiver.EmailAddress(History.Receiver)User.Emailfrom UserManager (History.Sender)
EnvelopeReceiverReadOnly.AddedWhomaps toReceiver.EmailAddress(principal key mapping, not receiver GUID).
Coordinate-Critical Fields
- Signature placement is persisted in
DocReceiverElementasX,Y,Width,Height,Page. - These coordinates are in INCHES (not PDF points, not pixels).
Cross-Module Tables in Same Context
EGDbContextalso includes UserManager entities:User,Group,Module,GroupOfUser,ModuleOfUser,UserRep, andClientUser.- Mail dispatcher entity
EmailOutis also registered under#if NETand trigger-configurable.
Trigger-Aware Model Notes
- Trigger names are injected from
DbTriggerParamsin appsettings and applied viaToTable(tb => tb.HasTrigger(...)). - Current trigger registration is explicit (
AddTrigger<T>()calls), not attribute/reflection driven. - Do not remove trigger mappings casually; this project depends on DB-side automation/audit behavior.
DevExpress
License: Commercial (v25.2.3) Components Used:
DxGrid- Master-detail gridsDxPdfViewer- Server-side PDF renderingDxPopup- Modal dialogsDxToolbar- Action barsDxFormLayout- Forms
Theme: Blazing Berry (default)
JavaScript Interop
PDF Viewer: wwwroot/js/pdf-viewer.js
window.pdfViewer = {
initialize(canvasId, pdfDataUrl, dotNetRef),
renderPage(num),
renderSignatureButtons(signatures, pageNum, dotNetRef),
applySignature(signatureId, dataUrl, fullName, position, place),
zoomIn(), zoomOut(), dispose()
}
Signature Pad: wwwroot/js/receiver-signature.js
window.receiverSignature = {
initializeDrawPad(canvasId, dotNetRef),
getSignatureDataUrl(canvasId),
clearPad(canvasId)
}
Multi-Envelope Support
Receivers can login to multiple envelopes simultaneously via per-envelope cookies:
AuthTokenSignFLOWReceiver.{envelopeKey}
Each envelope maintains independent authentication state.
External Dependencies
CDN:
- PDF.js 3.11.174:
https://cdnjs.cloudflare.com/ajax/libs/pdf.js/3.11.174/pdf.min.js
NuGet (Server.Client):
DevExpress.Blazor.*25.2.3SkiaSharp.*3.119.1 (WASM rendering)
External Services:
- LDAP/AD authentication (optional)
- GTX Messaging (SMS 2FA)
- Email dispatcher (signFlow)
Environment Variables
None required. All config in appsettings.json.
Local dev ports:
- App host (UI + API):
https://localhost:5131orhttp://localhost:7192