Razor Pages-style sample (implemented with MVC controllers and views) that showcases how to combine TX Text Control Web DocumentEditor with the TX Text Control Document Repository SDK. The app lets you create rich-text documents, edit them in the browser, track every version, and download or restore historical revisions from a file-based repository.
- Document dashboard with filtering by title/subject, tags, author, and status.
- Inline status updates (
active,draft,archived) plus delete, download, and restore actions for each entry. - Deep version history: every save produces a new repository version; previous versions can be restored or opened in the editor.
- Web-based editing experience powered by
TXTextControl.Web.DocumentEditorand background worker manager for WebSocket-based synchronization. - File-backed repository implementation via
IFileDocumentRepository, stored in a configurableDocumentRepositoryfolder inside the project root.
- .NET SDK 10 (Preview at the time of writing).
- TX Text Control packages referenced in
tx-repo-demo.csproj:TXTextControl.TextControl.Core.SDKTXTextControl.WebTXTextControl.Web.DocumentEditor.Backend
- Access to
TXTextControl.DocumentRepository.dll. The project references it via<Reference>with aHintPathpointing outside this repo. Adjust the path or place the assembly accordingly. You can clone/build the library from the TextControl/TXTextControl.DocumentRepository GitHub repo or use the binary that ships with licensed/trial TX Text Control installations.
- Clone and restore
git clone https://github.com/TextControl/TXTextControl.DocumentRepository.Demo.git cd TXTextControl.DocumentRepository.Demo/tx-repo-demo dotnet restore - Provide DocumentRepository assets
- Ensure
TXTextControl.DocumentRepository.dllis reachable at the hint path or update the path intx-repo-demo.csproj. The DLL can be built from TextControl/TXTextControl.DocumentRepository if you don't already have one. - Create a
DocumentRepositoryfolder in the project root (same level asProgram.cs). This folder holds repository metadata and binary content. You can copy existing.json/.txdata sets from another environment to seed demo data; otherwise it will stay empty until the first document is created.
- Ensure
- Run the site
Browse to the HTTPS URL shown in the console (typically
dotnet run
https://localhost:5001).
- Creating documents: Use the Create New Document modal on the dashboard. A blank document is generated by
ServerTextControland immediately opened in the editor. - Editing: The
/Edit/Indexview streams repository content into the Web DocumentEditor, and saving usesSaveToRepositoryAsyncto append a version. - Versioning: Version history lives under each document row. Restoring calls
RestoreVersionAsync, preserving the original revision and adding a restoration comment. - Status updates & deletion: AJAX calls hit
HomeController.UpdateStatusandHomeController.Deleterespectively. Both rely on repository APIs and return JSON for client-side feedback. - Data location: All documents and metadata sit inside the
DocumentRepositorydirectory. Deleting the folder wipes every stored document, so back up before upgrades or clean-ups.
Program.cswires TX Text Control services, WebSocket middleware, and registersFileDocumentRepositorythat targets the local storage folder.Controllers/HomeController.csrenders the dashboard, handles search, version restoration, status changes, downloads, and document creation.Controllers/EditController.csloads specific document versions into the editor and persists new revisions.Models/*provide view models for dashboard listings, version details, searches, and the edit surface.Views/Home/Index.cshtmlcontains the dashboard UI, modal forms, and version tables;Views/Edit/Index.cshtmlhosts the editor surface; shared layout and static assets live underViews/Sharedandwwwroot.
- Missing DocumentRepository assembly: Verify the
<HintPath>insidetx-repo-demo.csprojpoints to a valid build ofTXTextControl.DocumentRepository.dllor replace it with a NuGet/ProjectReference once available. - WebSocket issues: Confirm HTTPS is enabled (default template already configures it) and that
app.UseWebSockets()plusapp.UseTXWebSocketMiddleware()remain in the request pipeline. - Empty dashboard: Ensure the
DocumentRepositoryfolder exists and the IIS Express/Kestrel worker has write permissions. Creating a new document seeds the repository automatically.
- Deploy to IIS or Azure App Service by publishing the project and copying the persisted
DocumentRepositorydirectory. - Extend metadata (e.g., add approval workflow) by augmenting the view models and repository custom properties.
- Integrate authentication/authorization to replace the placeholder
User.Identity?.Name ?? "Anonymous"logic.