Polhem.Api.Contracts 1.3.0

dotnet add package Polhem.Api.Contracts --version 1.3.0
                    
NuGet\Install-Package Polhem.Api.Contracts -Version 1.3.0
                    
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="Polhem.Api.Contracts" Version="1.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Polhem.Api.Contracts" Version="1.3.0" />
                    
Directory.Packages.props
<PackageReference Include="Polhem.Api.Contracts" />
                    
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 Polhem.Api.Contracts --version 1.3.0
                    
#r "nuget: Polhem.Api.Contracts, 1.3.0"
                    
#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 Polhem.Api.Contracts@1.3.0
                    
#: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=Polhem.Api.Contracts&version=1.3.0
                    
Install as a Cake Addin
#tool nuget:?package=Polhem.Api.Contracts&version=1.3.0
                    
Install as a Cake Tool

Polhem Framework

繁體中文

Build CI Quality Gate Status Bugs Vulnerabilities Code Smells Coverage

Polhem Framework is an N-Tier + Clean Architecture + MVVM hybrid designed to accelerate the development of enterprise information systems. It adopts a Definition-Driven Architecture, using FormSchema as the single source of truth to drive UI layout, database schema, and business validation in a unified way.

📌 N-tier means the architecture is divided into more than three logical layers. In Polhem, the system is separated into at least five layers: presentation, API communication, business logic, data access, and database — each with a clearly defined responsibility.

All packages target net10.0.

✨ Features

  • Definition-Driven Architecture: FormSchema serves as the single source of truth, automatically deriving UI layout (FormLayout), database schema (TableSchema), and validation rules — define once, sync everywhere.
  • N-Tier + Clean Architecture + MVVM: Clear separation of presentation, API, business logic (BO), and data access layers, borrowing the best concepts from each pattern for enterprise information systems.
  • Cross-platform compatibility: All packages target net10.0 for modern .NET runtime support.
  • Multi-database support: Built-in dialects for SQL Server, PostgreSQL, SQLite, MySQL, and Oracle; host applications register only what they use.
  • Modular components: Decoupled libraries for core utilities, data, caching, business logic, and API hosting.
  • Rapid development: Reusable base classes and FormSchema-driven CRUD reduce repetitive boilerplate.
  • Conventions enforced at build time: Roslyn analyzers ship with the packages and register automatically, turning framework conventions — database scope selection, cross-file definition consistency, wire contract shape — into build diagnostics that name both the cause and the fix. See Analyzer Rules.

📐 Architecture

For an in-depth look at the layered architecture, data flow, and design decisions behind Polhem, see the Architecture Overview.

For guidelines on API Contract and BO Parameter design (Request/Response vs Args/Result), see the API/BO Contract Design Principles. The full catalog of public API methods, with each method's [ApiAccessControl] settings, lives in the API Method Reference.

For calling the JSON-RPC API from a JavaScript / TypeScript frontend (React, Vue, Angular, vanilla — no .NET on the client), see the JSON-RPC Frontend Integration Guide.

For the full developer documentation index, see docs/en/README.md.

📦 Assembly

Each assembly below ships as a NuGet package of the same name. A JSON-RPC server starts with two of them, plus Polhem.JsonRpc.AspNetCore for the HTTP endpoint:

dotnet add package Polhem.Hosting
dotnet add package Polhem.JsonRpc.AspNetCore
dotnet add package Polhem.Db

Getting Started continues from there.

Shared (Frontend / Backend)

Assembly Name Description
Polhem.Core.dll Core utilities such as serialization, encryption, and general-purpose helpers.
Polhem.Definition.dll Defines system-wide structured types including FormSchema, field schemas, and layout configurations.
Polhem.Expressions.dll Portable, sandboxed expression evaluator (DynamicExpresso-backed) for computed fields and validation rules; shared by backend save and Avalonia client live preview so both sides compute identically.
Polhem.Api.Contracts.dll Shared data contracts (request/response models) used by both frontend and backend.
Polhem.Api.Core.dll Encapsulates API support such as model definitions, payload encryption, and serialization pipeline.

Backend

Assembly Name Description
Polhem.Repository.Abstractions.dll Interface contracts for the business layer to access the data layer; boundary between Business Object and Repository.
Polhem.ObjectCaching.dll Runtime caching of FormSchema definitions and derived system data to improve performance.
Polhem.Db.dll Database abstraction with dynamic SQL command generation and connection binding; ships dialects for SQL Server, PostgreSQL, SQLite, MySQL, and Oracle.
Polhem.Repository.dll Common repository base classes and FormSchema-driven data access mechanisms.
Polhem.Business.dll Core business logic (Business Object / BO) implementing use-case workflows.
Polhem.Hosting.dll Composition root — AddPolhemFramework extension registering all backend services into any IServiceCollection (no ASP.NET Core dependency). Used by ASP.NET Core, WinForms, Console, and Worker Service hosts.

Frontend

Assembly Name Description
Polhem.Api.Client.dll Connector for local or remote invocation of backend Business Objects (LocalApiProvider / RemoteApiProvider).
Polhem.UI.Core.dll Cross-platform UI common layer (ClientInfo / IEndpointStorage / FileEndpointStorage / IUIViewService); shared by native UI hosts for client-side connection state and endpoint persistence.
Polhem.UI.Avalonia.dll Avalonia control library for desktop (Windows / macOS / Linux), browser (WebAssembly), iOS and Android heads; ships FormSchema-driven controls (FormView / ListView / GridControl plus a field-editor family with FormScope ambient binding, all backed by FormDataObject). Single net10.0 TFM; Avalonia 12.0.0 + DataGrid 12.0.0 as lower bound.
Polhem.Web.Blazor.Server.dll Razor Class Library (RCL) for Blazor Server hosts; provides DI-scoped connectors and Blazor components (DynamicForm, FormDataObject).

Tooling (dotnet tool)

Package Install Description
Polhem.Cli dotnet tool install -g Polhem.Cli <br/>Upgrade: dotnet tool update -g Polhem.Cli Framework CLI invoked as dotnet polhem. The defines commands materialise and list the framework default define files embedded in Polhem.Definition.dll (to bootstrap a new consumer's DefinePath); the keys commands generate protected keys for SystemSettings.xml. See the Polhem.Cli README; dotnet polhem --help lists the options.

🚀 Quick Start

Want to see Polhem running in 30 seconds?

# Terminal 1 — start the JSON-RPC API host
cd samples/QuickStart.Server
dotnet run

# Terminal 2 — connect and call the Echo BO
cd samples/QuickStart.Console
dotnet run

The console will print System.Ping status and an echoed message returned from a custom BO. See samples/README.md for the full demo list and what each one shows.

Ready to build your own? Getting Started walks through the same thing from an empty folder — packages, DefinePath, DI wiring, your first business object, and calling it from a client.

apps/Polhem.Northwind is the flagship demo: the classic Northwind inventory case built almost entirely from definitions (master files, master-detail orders with lookups, exactly one hand-written business object — everything else is XML). The same shared Polhem.Northwind.UI runs on four Avalonia heads — Desktop, Browser (WASM), iOS, and Android — against one JSON-RPC server.

The same Order form rendered by each head — same definitions, same controls, only the platform shell differs:

Desktop Browser (WASM)
<img src="https://raw.githubusercontent.com/polhem-dev/polhem/main/apps/Polhem.Northwind/docs/images/desktop-order-detail.png" alt="Desktop — order detail" width="420"> <img src="https://raw.githubusercontent.com/polhem-dev/polhem/main/apps/Polhem.Northwind/docs/images/browser-order-detail.png" alt="Browser — order detail" width="420">
iOS Android
<img src="https://raw.githubusercontent.com/polhem-dev/polhem/main/apps/Polhem.Northwind/docs/images/ios-order-detail.png" alt="iOS — order detail" width="200"> <img src="https://raw.githubusercontent.com/polhem-dev/polhem/main/apps/Polhem.Northwind/docs/images/android-order-detail.png" alt="Android — order detail" width="200">

More screens, the form catalog, and how to run it: apps/Polhem.Northwind/README.md.

💡 Sample Projects

All demos live in-repo under samples/. They're minimal, focused, and evolve alongside the framework. Build them with dotnet build samples/Polhem.Samples.slnx (kept separate from the main Polhem.slnx, so the main CI/build stays unaffected).

Category Demo Shows
QuickStart QuickStart.Server + QuickStart.Console Minimal JSON-RPC end-to-end with a custom anonymous BO
Blazor Server Blazor.Server.Demo PolhemLoginPanel + FormPage + Staff CRUD, dispatched in-process via LocalApiProvider
Avalonia Avalonia.DemoCenter Theme-oriented control demo center (DevExpress-style): nav tree (theme → case) + Demo/Source tabs + theme/FormMode toolbar; covers data binding, read-only/required, FormMode, layout, grid, native-vs-inherited parity (Semi.Avalonia, no backend)

Migrating from Bee.NET

Polhem continues the Bee.NET framework (Bee.* packages) under a new name, with no compatibility layer. What an upgrade has to change is in Migrating from Bee.NET.

Design decisions

The reasons behind the design are recorded in the architecture decision records.

Contributing

See CONTRIBUTING.md.

License

MIT. Copyright (c) Polhem contributors.

📬 Contact & Follow

Polhem is maintained by the polhem-dev organisation on GitHub.

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 (2)

Showing the top 2 NuGet packages that depend on Polhem.Api.Contracts:

Package Downloads
Polhem.Api.Core

The JSON-RPC 2.0 layer of the Polhem framework: request and response messages, the payload codecs, compression and encryption, and the server-side dispatcher.

Polhem.Business

Implements core business logic and application-level workflows.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.3.0 0 10/5/2026