BlazorWebForms.Infrastructure.SqlServer 1.1.2

dotnet add package BlazorWebForms.Infrastructure.SqlServer --version 1.1.2
                    
NuGet\Install-Package BlazorWebForms.Infrastructure.SqlServer -Version 1.1.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BlazorWebForms.Infrastructure.SqlServer" Version="1.1.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BlazorWebForms.Infrastructure.SqlServer" Version="1.1.2" />
                    
Directory.Packages.props
<PackageReference Include="BlazorWebForms.Infrastructure.SqlServer" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add BlazorWebForms.Infrastructure.SqlServer --version 1.1.2
                    
#r "nuget: BlazorWebForms.Infrastructure.SqlServer, 1.1.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package BlazorWebForms.Infrastructure.SqlServer@1.1.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=BlazorWebForms.Infrastructure.SqlServer&version=1.1.2
                    
Install as a Cake Addin
#tool nuget:?package=BlazorWebForms.Infrastructure.SqlServer&version=1.1.2
                    
Install as a Cake Tool

BlazorWebForms

Structured form collection for Blazor applications.
Define forms as data, collect submissions, run approval workflows, and export results — without rebuilding UI for every new process.

License: AGPL-3.0 .NET 10 NuGet


What is BlazorWebForms?

BlazorWebForms is a library that lets you define forms as structured data (FormDefinition), render them dynamically, and collect submissions with full workflow support — all from a Blazor application.

You describe a form once. The library handles rendering, validation, drafts, file uploads, multi-step approvals, email notifications, PDF export, and search indexing.


Packages

Package Purpose
BlazorWebForms.Core Domain models, FormsApplicationService, all interfaces. Zero UI and zero DB dependencies.
BlazorWebForms.Infrastructure.SqlServer EF Core persistence (SQL Server/Azure SQL), file storage, email (SMTP, SendGrid, Graph), PDF export.
BlazorWebForms.Blazor Razor components — form builder workspace, dynamic renderer, admin dashboards.

Architecture

Your Blazor App
      │
      ▼
FormsApplicationService          ← single entry point for all operations
      │
      ├── IFormsRepository       ← persistence (implemented by Infrastructure.SqlServer)
      ├── IFileStorage           ← file storage (local disk or bring your own)
      ├── IEmailNotifier         ← email (SMTP / SendGrid / Graph / no-op)
      ├── IPermissionEvaluator   ← role-based access (override for custom rules)
      ├── ICurrentUserContext    ← who is logged in (you implement this)
      └── ICustomFieldHandler[]  ← optional: register your own field types

Core has no dependency on any database, email provider, or UI framework. Every integration point is an interface you can swap.


Quick Start

1. Install packages

dotnet add package BlazorWebForms.Core
dotnet add package BlazorWebForms.Infrastructure.SqlServer

2. Register services

// Program.cs
builder.Services.AddBlazorWebFormsCore();

builder.Services.AddBlazorWebFormsSqlServer(opt =>
{
    opt.ConnectionString = builder.Configuration.GetConnectionString("BlazorWebForms")!;
    opt.StorageRoot = Path.Combine(builder.Environment.ContentRootPath, "uploads");
});

// Required: tell the service who the current user is
builder.Services.AddScoped<ICurrentUserContext, YourCurrentUserContext>();

3. Apply database schema

On first run, call SeedAsync to create tables automatically:

await app.Services.GetRequiredService<FormsApplicationService>().SeedAsync();

Or generate a migration script for review before applying:

dotnet ef migrations script \
  --project src/BlazorWebForms.Infrastructure.SqlServer \
  --startup-project src/BlazorWebForms.SampleApp

4. Create and publish a form

var draft = await formsService.SaveDraftAsync(new SaveDraftRequest
{
    Name = "Travel Request",
    Slug = "travel-request",
    Definition = new FormDefinition
    {
        DefaultCulture = "en-US",
        Sections =
        [
            new FormSectionDefinition
            {
                Title = "Trip Details",
                Fields =
                [
                    new FormFieldDefinition { Id = "destination", Label = "Destination", Kind = FormFieldKind.Text, Required = true },
                    new FormFieldDefinition { Id = "depart-date", Label = "Departure date", Kind = FormFieldKind.Date, Required = true },
                    new FormFieldDefinition { Id = "reason",      Label = "Reason",         Kind = FormFieldKind.TextArea }
                ]
            }
        ]
    }
});

await formsService.PublishAsync(draft.Id);

5. Accept a submission

var entry = await formsService.SubmitEntryAsync(formId, new SubmitEntryRequest
{
    Answers = new() { ["destination"] = "Paris", ["depart-date"] = "2026-09-01" },
    Approvers = [new ApproverInput { Id = "E-1042", DisplayName = "Jane Smith", Email = "jane@example.com" }]
});

Feature Overview

Forms

  • 13 built-in field types — Text, TextArea, Number, Select, Radio, Checkbox, Date, File, RichText, Signature, RepeatableList, RankedChoice, and Custom (bring your own)
  • Visibility conditions — show/hide sections and fields using AND/OR rules against other field values
  • Localization — per-field/section/option localized labels with culture fallback chain
  • Branding — logo, hero image, accent color, button radius, surface color per form
  • Metadata bags — attach arbitrary Dictionary<string, string> to forms, sections, and fields
  • Schema versioning — definitions carry a SchemaVersion for forward-compatibility handling

Submissions

  • Draft flow — save, resume, and finalize multi-session drafts
  • Immutable revisions or overwrite-latest — configurable per form
  • File uploads — per-field constraints (size, MIME type, extension, file count)
  • Search indexing — mark fields as Searchable; text index is maintained on save

Approvals

  • Sequential multi-step approval — one approver per step, ordered
  • Approve / reject / resubmit — full state machine with server-side invariant enforcement
  • Audit trail — every action is appended to an immutable ApprovalAuditEvent log
  • Approver identityId (employee ID), DisplayName, and Email on each step
  • Email notifications — assignment, reminder, approval, rejection, and resubmit events

Infrastructure (SqlServer package)

  • EF Core 10 persistence with SQL Server / Azure SQL
  • Idempotent schema bootstrapSeedAsync applies column additions without a full migration runner
  • Local file storage — safe filename normalization, SHA-256 hash, signed short-lived download links
  • Text PDF export — structured entry export with configurable row/size limits
  • Email strategiesDryRun (default), Smtp, SendGrid, Graph (Microsoft 365)
  • Anti-abuse guards — per-minute upload and notification rate limits
  • Draft cleanup — background removal of stale drafts and orphaned files (configurable retention)
  • Operational telemetry — upload/PDF/email counters via IOperationalTelemetry

Extensibility

  • Register custom field types with AddCustomFieldHandler<T>()
  • Override any default implementation (IPermissionEvaluator, IConditionEvaluator, IFileStorage, …)
  • Plug in prefill providers (IFormPrefillProvider) for claim-based, employee-based, or custom data

Documentation

Document Description
docs/USING_BlazorWebForms.md Integration guide — NuGet, local feed, ProjectReference
docs/CORE_MODELS.md Complete domain model reference
docs/CORE_API_REFERENCE.md Full FormsApplicationService API
docs/CORE_EXTENDING.md Implementing interfaces, auth examples, custom field types
docs/CORE_LOCALIZATION.md Localization, culture resolution, condition evaluation
docs/QUESTION_TYPES.md Every field kind with properties, validation, and examples
src/BlazorWebForms.Core/README.md Core package reference
src/BlazorWebForms.Infrastructure.SqlServer/README.md SQL Server package reference

Running the Sample App

Prerequisites: .NET 10 SDK, SQL Server or LocalDB.

# Restore and build
dotnet restore
dotnet build -c Debug

# Apply database schema
dotnet ef database update \
  --project src/BlazorWebForms.Infrastructure.SqlServer/BlazorWebForms.Infrastructure.SqlServer.csproj \
  --startup-project src/BlazorWebForms.SampleApp/BlazorWebForms.SampleApp.csproj

# Run
dotnet run --project src/BlazorWebForms.SampleApp/BlazorWebForms.SampleApp.csproj -c Debug

Configuration (src/BlazorWebForms.SampleApp/appsettings.Development.json):

Key Default Notes
ConnectionStrings:BlazorWebForms LocalDB SQL Server connection string
BlazorWebFormsSqlServer:SchemaName bwf Optional schema prefix
BlazorWebForms:FileDownloadTokenSecret dev fallback Override before production

Dev login: use the top-right "Dev login" controls in the sample app shell to sign in as Manager, Owner, Approver, or Admin.


Running Tests

# Core isolated unit tests
dotnet run --project tests/BlazorWebForms.Core.Tests -c Debug

# SQL Server integration tests (requires LocalDB)
dotnet run --project tests/BlazorWebForms.Infrastructure.SqlServer.Tests -c Debug

License

AGPL-3.0-only. Commercial licensing inquiries: open an issue.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.2 100 8/12/2026
1.1.1 92 8/11/2026
1.1.0 104 8/11/2026
1.0.3 120 7/9/2026
1.0.2 118 6/24/2026
1.0.1 120 6/23/2026
1.0.0 129 6/16/2026