Anarchy.Toolkit.Configuration
1.0.0
See the version list below for details.
dotnet add package Anarchy.Toolkit.Configuration --version 1.0.0
NuGet\Install-Package Anarchy.Toolkit.Configuration -Version 1.0.0
<PackageReference Include="Anarchy.Toolkit.Configuration" Version="1.0.0" />
<PackageVersion Include="Anarchy.Toolkit.Configuration" Version="1.0.0" />
<PackageReference Include="Anarchy.Toolkit.Configuration" />
paket add Anarchy.Toolkit.Configuration --version 1.0.0
#r "nuget: Anarchy.Toolkit.Configuration, 1.0.0"
#:package Anarchy.Toolkit.Configuration@1.0.0
#addin nuget:?package=Anarchy.Toolkit.Configuration&version=1.0.0
#tool nuget:?package=Anarchy.Toolkit.Configuration&version=1.0.0
Anarchy I/O - Toolkit
Reusable, self-contained NuGet packages for building .NET services.
Each package is an independent dotnet project in a single solution (Anarchy.Toolkit.sln) and is
published independently (per-project dotnet pack/push). Each package id is Anarchy.Toolkit.<project name>
(src/Core.Events/ → Anarchy.Toolkit.Core.Events).
The toolkit is standalone: every dependency restores from nuget.org.
The repository follows a layered architecture, Core < Infrastructure <
Configuration < Hosting < Web < Build, where a project's layer is the prefix of its name (src/<Layer>.<Name>/, or src/Core/).
Dependencies only point down the layers, which make check_layering verifies. The Testing.* kits, the test
projects under tests/ and the samples/ sit outside the chain. Projects with concrete
services expose them through their own IDependencyInjectionModules, whose contract lives in Core.
See the Layered Architecture guide.
Generic code is string/generic-parameterized; domain enums are replaced with string cores plus
generic enum overloads/factories that call EnumExtension.ToDescription(). Entities are marked with
IEntity/IPersistedEntity.
Building
The repo ships a make + Nuke toolchain. Run make help
for the full, self-documenting list.
make install # restore (nuget.org only) + compile; WITH_HOOKS=true also installs the git pre-commit hook
make appsettings # generate untracked appsettings.Development.json from each appsettings.json.template (RESET=true re-asks every key)
make compile # build the solution (Nuke Compile, warnings-as-errors)
make build # clean + build
make lint # dotnet format --verify-no-changes
make lint_fix # dotnet format (auto-fix); AUTO_STAGE=true re-stages fixed files
make test # run all test projects (unit/integration/acceptance)
make test_unit # unit tests only (COMPILE=true to rebuild first)
make list_projects # list every project in the solution
make list_packages # list every package id + version
make pack # pack every package into a fresh artifacts/packages/<run-id>/ directory
make publish # pack + push to the NuGet feed (SOURCE=… required, API_KEY=… optional)
make upgrade_dependencies # bump centrally-managed package versions (dotnet-outdated)
You can also drive Nuke directly:
./scripts/build.nuke.sh <Target> # e.g. Compile, Lint, TestAll, Pack, Publish, ListProjects
make nuke TARGET=Pack
make nuke_help # list all Nuke targets + parameters
Plain dotnet also works:
dotnet build Anarchy.Toolkit.sln -c Release
dotnet pack Anarchy.Toolkit.sln -c Release -o ./artifacts/packages
Tooling layout
Makefile+scripts/make-targets/*.mk— self-documenting make targets (help parsed from#?/#+markers).scripts/dev-env/—upgrade-dependencies.shplus its helpers (get-shell-env-file.sh,variables.env).scripts/utils/—print-title.sh,makefile-help.sh,lint-fix-auto-stage.shandgit-hooks/(make git_hooks_enable|git_hooks_disable|git_hooks_show).scripts/build.nuke.sh— reloads the shell env (fresh SDK) then runs the Nuke project.build/— the Nuke build project, see Nuke build project.docs/guides/— conventions (index): architecture, async, enums, exceptions, endpoints, observability, UIs, testing and NUKE builds..nuke/parameters.json— marks the repo root and pinsSolution/Configuration.
Tests run on Microsoft.Testing.Platform (
global.json→test.runner). The Nuke test targets route xUnit v3 projects through MSBuild'sTesttarget and any VSTest project throughdotnet test.
Nuke build project
build/ is a thin consumer of the solution's own build components,
Anarchy.Toolkit.Build.Nuke (src/Build.Nuke),
referenced as a project so the build always runs the code it
builds and packs:
Build.cs—partial class Build : NukeBuild, INuGetBuild. All the standard targets come from the library:Restore,Compile,Lint/LintFix,TestUnit/TestIntegration/TestAcceptance/TestAll,Test(unit only),PullRequest,ListProjects,RunApp/RunApps,Clean/Build. Test projects are matched by kind through their name segments (Tests.Unit.*,*.Unit.Tests,*.Tests.Unitor plainUnit).INuGetBuildprovidesListPackages,Packand dependency-orderedPublish; see the NUKE guide.Build.CodeGeneration.cs—GenerateTools, regenerating the library's CLI tool wrappers from its specifications.Directory.Build.targets— imports the library'sbuildTransitivetargets, which serve the NuGet.* assemblies from the installed SDK so the build keeps working on newer SDK feature bands (e.g. 10.0.400).
Restoring needs nuget.org only.
nuget.configdeclares the source + mapping; credentials for the publish feed come from the machine/CI config.
Package catalogue
Every project under src/ is one package, and its package id, assembly name and root namespace are all
Anarchy.Toolkit.<project name> (src/Core.Events/ → Anarchy.Toolkit.Core.Events).
Legend: [Abs] abstractions-only · [Impl] concrete implementation · dependencies list sibling toolkit projects only (framework/NuGet deps omitted).
Core layer — domain and application abstractions
| Package | Purpose | Depends on |
|---|---|---|
Anarchy.Toolkit.Core |
Generic helpers/extensions (StringExtension, EnumExtension, DateHelper, JSON converters, …), the exception primitives (Exceptions/), markers IEntity/IPersistedEntity/IDeepCloneableEntity, the keyed client-resolver pattern (IClientResolver<T>, KeyedClientResolverBase<T>), and the DI module contract (IDependencyInjectionModule, UseModule<T>() and UseModule(module) for modules with constructor parameters, in Composition/). |
— |
Anarchy.Toolkit.Core.Observability [Impl] |
Observer facade (Logger, MeasurerBase, LogContext) with call-site logging/metrics, Tags, DevelopmentLogger, LoggerMeasurer, CallSiteEntity + CalledFrom()/ParentCaller(), generic LogContext extensions. |
Core |
Anarchy.Toolkit.Core.Events |
In-process pub/sub (ILocalEvent, ILocalEventHandler<T>, LocalEventBus + AddLocalEventBus) and the generic event pipeline (EventEnvelopeBase, generic Event/PersistedEvent, processor, handler bus, EventEnvelopeParser). |
Core, Core.Observability, Core.Messaging.Abstractions |
Anarchy.Toolkit.Core.Messaging.Abstractions [Abs] |
IMessageBrokerPublisher, in/out message entities, generic OutboundMessageBuilder. |
Core |
Anarchy.Toolkit.Core.Persistence.Abstractions [Abs] |
UoW, async-local flow context, storage policy, repository contracts + exceptions. | Core |
Anarchy.Toolkit.Core.Health [Abs] |
The one health model every endpoint shares: service health reports (IServiceHealthReport, ServiceHealthReportBase for timed, exception-safe checks), HealthCheckEntity, HealthCheckReport (HealthCheckReport.RunAsync(reports) runs them in parallel), ExceptionReport; plus IBuildMetadata and ApplicationRunbookUriAttribute. |
Core |
Infrastructure layer — adapters to external systems
| Package | Purpose | Depends on |
|---|---|---|
Anarchy.Toolkit.Infrastructure.Http |
HTTP repository/client plumbing: HttpRepositoryBase/ScopedHttpRepositoryBase, handlers (timeout, MSAL certificate auth), client configuration. |
Core, Core.Observability |
Anarchy.Toolkit.Infrastructure.Persistence.Db [Impl] |
Provider-agnostic relational layer: IDbDialect (static-abstract provider contract), UoW, connection pool base, (resilience) policy, retry builder, connection-string/options bases, repository bases (Db{Reader,Writer,BatchWriter}RepositoryBase<TConnection, TDialect, …>), AttributeIdCacheBase, DescriptionEnumTypeHandler, and DB health reports (DbHealthReportBase<TConnection, TDialect> runs the dialect's HealthCheckSql, test named {dialect}_connection-{reader\|writer}; AddDbHealthReports<TReaderReport, TWriterReport>()), and the provider-agnostic transactional outbox / event store (repository contracts under Core/, records, type-table cache, rollback handler, and Db{TaskOutboxReader,TaskOutboxWriter,DomainEventReader,EventWriter}RepositoryBase<TConnection, TDialect>). Options: DbConnectionOptions, DbResilienceOptions. |
Core, Core.Observability, Core.Persistence.Abstractions, Core.Events, Core.Health |
Anarchy.Toolkit.Infrastructure.Persistence.Postgres [Impl] |
Npgsql adapter: PostgresDbDialect, connection string/pool/envelope, PostgresDbUnitOfWork, retry builder, resilience policy, and PostgresDb*RepositoryBase aliases of the Db bases, plus Postgres health reports (AddPostgresHealthReports, ModulePostgresHealthReport), and ModulePostgres. Options: PostgresConnectionOptions, PostgresResilienceOptions. |
Core, Infrastructure.Persistence.Db |
Anarchy.Toolkit.Infrastructure.Persistence.Oracle [Impl] |
ODP.NET (Oracle.ManagedDataAccess.Core) adapter: OracleDbDialect, connection string (full connect descriptor with EXPIRE_TIME keepalive)/pool (per-connection command timeout + session time zone)/envelope, OracleDbUnitOfWork, retry builder, resilience policy, and OracleDb*RepositoryBase aliases of the Db bases, plus Oracle health reports (AddOracleHealthReports, ModuleOracleHealthReport; SELECT SYSDATE FROM DUAL, tests named oracle_connection-{reader\|writer}), and ModuleOracle. Options: OracleConnectionOptions (DbName = service name, port defaults to 1521), OracleResilienceOptions. |
Core, Infrastructure.Persistence.Db |
Anarchy.Toolkit.Infrastructure.Messaging.Aws [Impl] |
SNS and SQS publishers (AddSnsMessageBroker, AddSqsMessageBroker, ModuleSnsMessageBroker, ModuleSqsMessageBroker) over a shared AWS publisher base + request-builder base, inbound mapper, compression. Options: AwsMessagingOptions. |
Core, Core.Observability, Core.Messaging.Abstractions |
Anarchy.Toolkit.Infrastructure.Observability.Serilog [Impl] |
Standard log-property enrichers with overridable names (WithTeam, WithAppGroup, WithCostCenter, WithCostCenterFromEnvironment, WithLogRetention), WithAwsEc2InstanceId and the Ec2CloudWatch(logGroup) sink. |
Core |
Anarchy.Toolkit.Infrastructure.CorrelationId [Impl] |
Async-local CorrelationContext, ASP.NET Core UseCorrelationId() middleware (configurable headers, X-Correlation-Id/X-Attempt-Id by default), Serilog WithCorrelationId() enricher, ModuleCorrelationId. |
Core |
Configuration layer — settings, secrets and observability bootstrap
| Package | Purpose | Depends on |
|---|---|---|
Anarchy.Toolkit.Configuration |
One capability interface per settings section (IAuthServiceAppSettings, IOAuthAppSettings, IAwsAppSettings, IPostgresAppSettings, IOracleAppSettings, IResilienceAppSettings, IWorkerHealthCheckAppSettings, all deriving from IAppSettings) implemented by the consumer's own settings type, bound by ModuleAppSettingsBase<TAppSettings> (override RegisterAdditionalTypesForSettings to expose each interface in DI), secrets (Kms/Cached/InMemory services), vendor-neutral observability bootstrap (ModuleObservability + an overridable ObserverFactory), ModuleLibConfiguration<TAppSettingsDiModule, TAppSettings> (settings + observability + secrets in one module), config extensions (AddAwsSystemsManagerParameterStore(environment, prefix), called by the application). |
Core, Core.Observability, Infrastructure.CorrelationId |
Hosting layer — running a process
| Package | Purpose | Depends on |
|---|---|---|
Anarchy.Toolkit.Hosting |
The IStartup contract and UseStartup<TStartup>(appRunnerType), generic startup + entry points for jobs and workers (JobStartupBase, JobEntryPointBase, WorkerEntryPointBase, AppHostBuilder) with an overridable ConfigureAppConfiguration hook (configuration sources such as the Parameter Store are the application's choice); DiFactory<TAppSettingsDiModule, TAppSettings>.Build(...). |
Core, Configuration |
Anarchy.Toolkit.Hosting.Workers [Impl] |
WorkerBase, MonitoredWorkerBase, ResilientWorkerBase, HeartbeatWorker, and the workers' health API: ServiceHealthCheckWorker (AddServiceHealthCheckWorker(assembly)) self-hosts /health/instance, /health/services (the registered IServiceHealthReports as a HealthCheckReport, same JSON as the web API's health controller; 500 when a test fails) and /health/status (build metadata), via SelfHostedApplicationHealthApi, the ASP.NET Core middleware and ModuleApplicationHealth. |
Core, Configuration, Core.Observability, Core.Health |
Web layer — API and UI pipelines
| Package | Purpose | Depends on |
|---|---|---|
Anarchy.Toolkit.Web |
REST API pipeline: startup/entry-point bases (RestApiWebAppStartupBase, WebAppEntryPoint, AwsWebAppEntryPointBase), middleware, auth (generic scopes via params), swagger, JSON converters, validation attributes, health controller. |
Hosting, Infrastructure.Http, Core.Health, Core.Persistence.Abstractions |
Anarchy.Toolkit.Web.GraphQL |
Generic GraphQL wiring (AddToolkitGraphQl<TSchema>, UseToolkitGraphQl<TSchema>, SchemaBase, GraphQlRoutes). |
Web |
Anarchy.Toolkit.Web.Ui |
Interactive-server Blazor UI pipeline: UiWebAppStartupBase, cookie-session OAuth login against a consumer-supplied environment catalog, UiApiClientBase for downstream APIs, and reusable components (notifications, confirmation modals, JSON viewer, pagination, login form). See the Building UIs guide. |
Web |
Build layer — build tooling (top of the chain: nothing ships with a dependency on it)
| Package | Purpose | Depends on |
|---|---|---|
Anarchy.Toolkit.Build.Nuke |
NUKE build components in Component/ (IDefaultBuild, IVersionedBuild, IStandardBuild, IContainerBuild, ICodeDeployBuild, IAwsLambdaBuild, IFullReleaseBuild, IHasAcceptanceTests, IReportFailureOnSlack), MTP-aware test runner, KMS secrets, user secrets. See the NUKE builds guide. |
— |
Testing kits — packable test helpers (outside the layer chain)
| Package | Purpose | Depends on |
|---|---|---|
Anarchy.Toolkit.Testing |
TestCaseBase / TestCaseBase<TAppSettings>, TestHelper, InMemoryObserver, EntityFixtureBase, API-gateway assertions (AwesomeAssertions), in-memory metrics + Serilog sink with assertions (Helper.Observability.Monitoring). |
Core, Core.Observability, Configuration |
Anarchy.Toolkit.Testing.Db |
DbTestHelper (RegisterEnumTypeHandler<TEnum>(), TruncateTableAsync<TConnection, TDialect>, ClearTableAsync) + DbOptionsMapper. |
Testing, Infrastructure.Persistence.Db |
Anarchy.Toolkit.Testing.Postgres |
PostgresHelper/SingletonPostgresHelper + PostgresOptionsMapper, generic RegisterEnumTypeHandler<TEnum>(). |
Testing.Db, Infrastructure.Persistence.Postgres |
Anarchy.Toolkit.Testing.Oracle |
OracleHelper/SingletonOracleHelper + OracleOptionsMapper, generic RegisterEnumTypeHandler<TEnum>(). |
Testing.Db, Infrastructure.Persistence.Oracle |
Anarchy.Toolkit.Testing.Aws |
LocalStack SNS/SQS helpers (SqsHelper, AwsMessageBrokerHelper), SqsMessageFixture (string-named topics/queues). |
Testing, Infrastructure.Messaging.Aws |
Anarchy.Toolkit.Testing.Web |
RestApiTestCaseBase<TStartup, TAppSettings> (native + Lambda), TestableLambdaEntrypoint, generic MockAuthorizationToken<TAppSettings>(scopes). |
Testing, Web |
Samples and company extras
Company-specific behaviour is not part of the toolkit: organisations plug their conventions into its extension points (an overridable ObserverFactory, options and constructor parameters, ConfigureAppConfiguration hooks). samples/ holds sample applications (REST API, Lambda job, EC2 worker, back-office UI) built on the toolkit's defaults.
Consuming a package
Each impl package ships a DI registration entry point (either an IDependencyInjectionModule
or a ServiceCollection extension), so consumers bind classes without manual wiring, e.g.:
services.AddLocalEventBus();
services.AddSnsMessageBroker(new AwsMessagingOptions("eu-west-1", "123456789012"));
services.AddSqsMessageBroker(new AwsMessagingOptions("eu-west-1", "123456789012"));
services.AddPostgresHealthReports();
// or, as modules (options come from the application's configuration, never a hard-coded section):
services
.UseModule(new ModuleSnsMessageBroker(config => new AwsMessagingOptions(config["Aws:Region"]!, config["Aws:AccountId"]!)),
configuration, environment)
.UseModule<ModulePostgresHealthReport>(configuration, environment);
See Dependency-injection modules for the modules each package ships.
Adding a database provider
Infrastructure.Persistence.Db and Testing.Db hold everything that is not provider-specific; a provider
(Postgres and Oracle today) only adds a thin adapter, mirroring the *.Postgres / *.Oracle projects:
- Infrastructure.Persistence.<Provider> — a dialect implementing
IDbDialect(Name,IsNoData,IsUniqueViolation, plus overrides of the ANSI defaults that differ:IsServerError,IsTransient, savepoint SQL — returnnullfromSavepointReleaseSqlwhen the provider has noRELEASE SAVEPOINT—,ToBatchParameters,HealthCheckSql,TruncateTableSql), a connection string (DbConnectionStringBase<TOptions>), a pool (DbConnectionPoolBase<TConnection>.CreateConnection), and one-line UoW / policy / retry-builder / repository-base subclasses closing the generics over the provider's connection and dialect, plus aModule<Provider>underDependencyInjection/Module/. - Outbox, outside the toolkit — the toolkit ships only the
Db*RepositoryBase<TConnection, TDialect>outbox bases. Consumers (or an adapters package) add keyed-DI concretes over them, with the provider's SQL in aQueries/folder next to them (LoadSqlresolves from the most derived type's namespace). OverrideIdSequenceNameif the sequences are named differently. - Health, in Infrastructure.Persistence.<Provider> — reader/writer subclasses of
DbHealthReportBase, anAdd<Provider>HealthReports()extension and aModule<Provider>HealthReport. - Testing.<Provider> — helpers delegating to
DbTestHelper.
Notes & follow-ups
- Independent versioning: every project carries its own
<Version>; all start at1.0.0for the first release. AProjectReferencebetween toolkit projects is emitted as a NuGet<dependency>on pack, so the in-repo dev loop and published dependency metadata both work withoutPackageReferencejuggling. - Oracle specifics: SQL files must not end with
;(ODP.NET rejects it) and use:Namebinds (Dapper turns onBindByName). The outbox get-or-insert of type ids runsCommon.<Type>.Insert.IfMissing(MERGE) thenCommon.<Type>.Get.ByName, as Oracle cannot select from anINSERT(IDbDialect.CanSelectFromInsert). Ids areCAST(… AS NUMBER(9|18))so ODP.NET returnsint/long. Savepoints are never released (no such statement).TruncateTableAsyncuses plainTRUNCATE TABLE(no identity restart / cascade). - Known persistence gaps (pre-existing, carried over by the Db extraction):
GetLatestSequenceValueAsyncloadsCommon.LatestSequenceValue.Get.sql, which no package ships yet; the outbox type-id cache is shared by everyAttributeIdCacheBase<EventTypeTable, int>subclass, so two providers in one process would share type ids; andDbRepositoryBase's SQL cache is keyed by file name only (per connection type), so two repositories overriding the same query name collide. Anarchy.Toolkit.Web.Uiholds only domain-free UI plumbing; API clients, pages and the concrete environment URLs belong to the consumer (supplied throughUiAuthenticationOptions.Environments).- Domain code (task orchestration, concrete repositories and clients, domain event payloads, message destinations, swagger scopes, UI environment URLs) intentionally stays in consuming applications.
- Assertions: the toolkit uses AwesomeAssertions rather than FluentAssertions;
only the
Anarchy.Toolkit.Testing*packages depend on it (verified on the packed nuspecs). - Tests: test projects are never published, so there is one per test kind:
tests/Unit/Unit.csprojholds every unit test, in one folder persrc/project whose dotted name becomes nested folders (src/Core.Events→tests/Unit/Core/Events/), with test classes mirroring the package's folders (xunit.v3 on Microsoft.Testing.Platform, AwesomeAssertions, Moq; shared settings intests/Directory.Build.props), with domain types replaced by test-local dummies.make test_unitruns them; there are no integration/acceptance projects yet (they would need Postgres/LocalStack and a schema).
| Product | Versions 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. |
-
net10.0
- Amazon.Extensions.Configuration.SystemsManager (>= 7.1.1)
- Anarchy.Toolkit.Core (>= 1.0.0)
- Anarchy.Toolkit.Core.Observability (>= 1.0.0)
- Anarchy.Toolkit.Infrastructure.CorrelationId (>= 1.0.0)
- AWSSDK.Core (>= 4.0.102.15)
- AWSSDK.Extensions.NETCore.Setup (>= 4.0.102.7)
- AWSSDK.KeyManagementService (>= 4.0.101.1)
- AWSSDK.SecretsManager (>= 4.0.100.22)
- Humanizer (>= 3.0.10)
- Microsoft.Extensions.Caching.Memory (>= 10.0.14)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.14)
- Microsoft.Extensions.Configuration.Json (>= 10.0.14)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.14)
- Microsoft.Extensions.Hosting (>= 10.0.14)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.14)
- Microsoft.Extensions.Options.DataAnnotations (>= 10.0.14)
- Microsoft.Identity.Client (>= 4.92.0)
- Newtonsoft.Json (>= 13.0.4)
- Serilog (>= 4.4.0)
- Serilog.Sinks.Console (>= 6.1.1)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on Anarchy.Toolkit.Configuration:
| Package | Downloads |
|---|---|
|
Anarchy.Toolkit.Testing
Shared base test toolkit: TestCaseBase, TestHelper, in-memory test telemetry (log and metric capture), API Gateway response assertions, entity fixtures, and common test extensions. |
|
|
Anarchy.Toolkit.Hosting
Generic startup and entry-point bootstrapping for Jobs and Workers (Lambda and EC2). |
|
|
Anarchy.Toolkit.Testing.Db
Provider-agnostic relational database test helpers (DbTestHelper: enum type handlers and table truncate/clear; DbOptionsMapper) for integration tests. |
|
|
Anarchy.Toolkit.Hosting.Workers
Worker pipeline: monitored/resilient background workers, heartbeat, and a self-hosted health API (service health reports, build metadata) for workers. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Initial release.