Table of Contents

Class ConventionContext

Namespace
McMaster.Extensions.CommandLineUtils.Conventions
Assembly
McMaster.Extensions.CommandLineUtils.dll

The context in which a convention is applied.

public class ConventionContext
Inheritance
object
ConventionContext

Constructors

ConventionContext(CommandLineApplication, Type?)

Initializes an instance of ConventionContext.

public ConventionContext(CommandLineApplication application, Type? modelType)

Parameters

application CommandLineApplication

The application

modelType Type

The type of the model.

Properties

Application

The application to which the convention is applied.

public CommandLineApplication Application { get; }

Property Value

CommandLineApplication

HasGeneratedMetadata

Gets a value indicating whether source-generated metadata is available for the model type. When true, metadata was generated at compile time and can be used without reflection.

public bool HasGeneratedMetadata { get; }

Property Value

bool

MetadataProvider

Gets the metadata provider for the model type. Returns null if ModelType is null. This provider may contain source-generated metadata (AOT-friendly) or fall back to reflection-based metadata extraction.

public ICommandMetadataProvider? MetadataProvider { get; }

Property Value

ICommandMetadataProvider

ModelAccessor

A convenience accessor for getting the application model object. Can be null when applied to CommandLineApplication instead of CommandLineApplication<TModel>.

public IModelAccessor? ModelAccessor { get; }

Property Value

IModelAccessor

ModelType

The type of the application model. Can be null when applied to CommandLineApplication instead of CommandLineApplication<TModel>.

public Type? ModelType { get; }

Property Value

Type