Table of Contents

Class ConfigureHostAttribute

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

Marks an interface as a source of configuration for the built host of any build definition that implements it.

[AttributeUsage(AttributeTargets.Interface)]
public sealed class ConfigureHostAttribute : Attribute
Inheritance
object
Attribute
ConfigureHostAttribute

Examples

[ConfigureHost]
public partial interface IMyModule
{
    protected static partial void ConfigureHostFromIMyModule(IHost host) =>
        host.Services.GetRequiredService<IMyService>().Initialize();
}

[BuildDefinition]
internal partial class Build : BuildDefinition, IMyModule;

Remarks

The interface must be partial. The source generator declares protected static partial void ConfigureHostFrom{InterfaceName}(IHost host) on the interface, which the interface must implement (analyzer AT0002 reports a missing implementation). The generated ConfigureHost(IHost) of every build definition that implements the interface calls this method from UseAtom(IHost), after the host is built.

Constructors

ConfigureHostAttribute()

public ConfigureHostAttribute()