Elarion

Installation

Add Elarion's packages and source generators to an application project and an ASP.NET Core host.

Elarion is distributed as a set of focused NuGet packages plus one npm package for TypeScript client generation. You only install the pieces you use.

Prerequisites

  • .NET 10 SDK or later. The framework targets net10.0; the source generators target netstandard2.0 so they load in the Roslyn analyzer host.
  • An ASP.NET Core host project if you want the JSON-RPC HTTP transport (Elarion.AspNetCore).
  • Node.js 18+ only if you generate the TypeScript JSON-RPC client.

Packages

PackageInstall inPurpose
Elarion.AbstractionsApplicationAttributes and contracts: [AppModule], [Service], [ScheduledJob], IHandler<,>, Result<T>, AppError.
ElarionApplication / hostRuntime primitives: decorators, the in-memory scheduler, current-user abstraction, and the default authorizer. Depends only on Microsoft.Extensions.* abstractions (ADR-0017). Bundles the Elarion source generator (handlers, services, modules, RPC/HTTP/MCP maps, validation resolvers, resilience policies, scheduled jobs, event consumers).
Elarion.CachingApplication / hostHybridCache-backed default IHandlerCache for handler result caching — services.AddElarionHandlerCaching(). Required by [Cacheable]/[CacheInvalidate] (extracted from core, ADR-0017).
Elarion.ResilienceApplication / hostMicrosoft/Polly-backed default IResiliencePipelineRunnerservices.AddElarionResilience(). Required by [Resilient] handlers and deferred scheduler retries (extracted from core, ADR-0017).
Elarion.ValidationApplication (+ services.AddElarionValidation() in the host)Microsoft.Extensions.Validation-backed default IRequestValidatorrequired to enforce the DataAnnotations validation attributes on request DTOs (otherwise they are schema-documented but unenforced, ELVAL002). See Validation.
Elarion.FeatureFlags.OpenFeatureApplication / hostDefault IFeatureFlagService over OpenFeature for [FeatureGate]/[FeatureVariant]services.AddElarionOpenFeature(). Bring your own OpenFeature provider.
Elarion.FeatureFlags.FeatureManagementApplication / hostBatteries-included config-driven flags via the Microsoft.FeatureManagement OpenFeature provider — services.AddElarionFeatureManagement(configuration).
Elarion.BlobsApplicationProvider-neutral blob storage contracts and DTOs.
Elarion.Blobs.PostgreSqlInfrastructure / hostPostgreSQL-backed blob storage using EF Core model configuration and Npgsql content I/O.
Elarion.JsonRpcHostTransport-neutral JSON-RPC dispatcher, envelopes, telemetry, and schema export.
Elarion.GrpcCustom gRPC hostHost-neutral unary and request-driven server-streaming invocation, configurable principal capture, and stable startup AppErrorRpcException translation. Bring your own host and generated protobuf contracts.
Elarion.Grpc.AspNetCoreASP.NET Core gRPC hostRecommended grpc-dotnet conventions: AddGrpc().AddElarion(), automatic HttpContext.User/RequestServices adoption, and delegate-free ServerCallContext.InvokeElarionAsync<TRequest,TResponse>(request)/InvokeElarionStreamAsync<TRequest,TItem>(request) dispatch.
Elarion.AspNetCoreHostASP.NET Core JSON-RPC endpoint mapping, batch execution, and current-user middleware.
Elarion.AspNetCore.SchemaGenerationHost (build tooling)MSBuild target that exports rpc-schema.json during dotnet build.
Elarion.EntityFrameworkCoreApplicationMarker attributes for generated DbSets and entity inclusion. Bundles the EF Core source generator (DbSet properties, entity configuration, keyset pagination).
@swimmesberger/elarion-jsonrpc-client-generatorFrontend (npm)Generates TypeScript method contracts, constraint-aware Zod params/result schemas, and a params-pre-validating fetch client from a schema export.
@swimmesberger/elarion-contributionsFrontend (npm)The frontend contribution model: typed extension points, declarative module manifests, and capability-gated resolution; React bindings under /react. See Frontend modules.

The source generators ship inside their runtime packages — the Elarion generator in Elarion and the EF Core generator in Elarion.EntityFrameworkCore. There are no separate analyzer packages to install. Because NuGet analyzer assets are not transitive, every assembly that needs a generator must reference its package directly: Elarion for handlers/modules/transports, and Elarion.EntityFrameworkCore for any assembly that declares [EntityConfiguration]/[GenerateDbSets] types or holds the concrete DbContext (a pure domain/entity project declares neither — entities are plain classes — so it needs no reference).

Caching and resilience are now opt-in packages (ADR-0017, breaking). The HybridCache-backed handler cache moved to Elarion.Caching and the Polly-backed resilience runner to Elarion.Resilience — neither ships in Elarion core anymore. If you use [Cacheable]/[CacheInvalidate], add Elarion.Caching and call services.AddElarionHandlerCaching(). If you use [Resilient] handlers or deferred scheduler retries, add Elarion.Resilience and call services.AddElarionResilience()AddElarionScheduler no longer auto-wires the resilience runner, so a copy-paste upgrade that drops these references silently loses caching and resilience.

Application project

An application (class library) holds your modules, handlers, and services. Add the runtime package — the source generator ships inside it:

<ItemGroup>
  <PackageReference Include="Elarion" Version="0.2.6" />
</ItemGroup>

Then enable the framework generators once, anywhere in the assembly (commonly in a Usings.cs or AssemblyInfo.cs):

using Elarion.Abstractions;

[assembly: UseElarion]

[assembly: UseElarion] turns on the framework-owned application generators, including handlers, services, jobs, event consumers, actor facades, policy registration, and typed catalogs. If you want only a subset, use the narrower triggers instead — see Source generation.

Host project

The ASP.NET Core host references your application and the JSON-RPC packages. It also needs the Elarion generator (for the RPC map and module bootstrapper it emits in the host assembly), which lives in the Elarion package — and since analyzer assets are not transitive, the host references Elarion directly (it already depends on it transitively via Elarion.AspNetCore):

<ItemGroup>
  <PackageReference Include="Elarion" Version="0.2.6" />
  <PackageReference Include="Elarion.JsonRpc" Version="0.2.6" />
  <PackageReference Include="Elarion.AspNetCore" Version="0.2.6" />
  <ProjectReference Include="..\MyApp.Application\MyApp.Application.csproj" />
</ItemGroup>

The Quickstart wires these together into a working JSON-RPC endpoint.

Optional: build-time schema export

To export rpc-schema.json automatically during dotnet build, add the schema generation package as private build tooling in the host:

<ItemGroup>
  <PackageReference Include="Elarion.AspNetCore.SchemaGeneration"
                    Version="0.2.6"
                    PrivateAssets="all" />
</ItemGroup>

<PropertyGroup>
  <ElarionJsonRpcGenerateSchema>true</ElarionJsonRpcGenerateSchema>
</PropertyGroup>

See JSON-RPC schema generation for the full set of properties.

Optional: TypeScript client generator

Install the generator in your frontend app and run it against an exported schema:

npm install --save-dev @swimmesberger/elarion-jsonrpc-client-generator
npx elarion-jsonrpc-client-generator --schema rpc-schema.json --out src/generated

The generated client imports zod, so install it as a runtime dependency. See TypeScript client for usage.

Building from source

To build the framework itself rather than consume the published packages:

git clone https://github.com/swimmesberger/Elarion.git
cd Elarion
dotnet restore Elarion.slnx
dotnet build Elarion.slnx --configuration Release
dotnet test --project tests/Elarion.Tests/Elarion.Tests.csproj --configuration Release

When building from source, reference the generator projects with OutputItemType="Analyzer" ReferenceOutputAssembly="false" instead of a PackageReference.

On this page