Table of Contents

Class HostExtensions

Namespace
Invex.Atom.Build.Hosting
Assembly
Invex.Atom.Build.dll

Provides extension methods for configuring and integrating Atom services into a .NET host.

public static class HostExtensions
Inheritance
object
HostExtensions

Remarks

This class simplifies the setup of an Atom application by registering essential services, logging providers, and dependencies required for the Atom framework to function correctly.

Methods

AddAtom<TBuilder, TBuild>(TBuilder, string[])

Configures the Microsoft.Extensions.Hosting.IHostApplicationBuilder with all necessary Atom services, dependencies, logging, and default settings.

public static TBuilder AddAtom<TBuilder, TBuild>(this TBuilder builder, string[] args) where TBuilder : IHostApplicationBuilder where TBuild : BuildDefinition, IConfigureHost

Parameters

builder TBuilder

The host application builder instance to configure.

args string[]

The command-line arguments provided to the application.

Returns

TBuilder

The configured host application builder instance.

Type Parameters

TBuilder

The type of the host application builder.

TBuild

The type of the build definition, which must derive from BuildDefinition and implement IConfigureHost. Classes generated for BuildDefinitionAttribute do both.

Remarks

This method performs the following key configurations:

UseAtom(IHost)

Configures the built Microsoft.Extensions.Hosting.IHost instance for Atom-specific behaviors.

public static IHost UseAtom(this IHost host)

Parameters

host IHost

The Microsoft.Extensions.Hosting.IHost instance to configure.

Returns

IHost

The configured Microsoft.Extensions.Hosting.IHost instance.

Remarks

This method invokes ConfigureHost(IHost) of the build definition type passed to AddAtom<TBuilder, TBuild>(TBuilder, string[]), allowing for post-build host configuration. It does nothing when the host was not configured with AddAtom<TBuilder, TBuild>(TBuilder, string[]). The build definition itself is not resolved.