Class ConventionContext
- Namespace
- McMaster.Extensions.CommandLineUtils.Conventions
- Assembly
- McMaster.Extensions.CommandLineUtils.dll
The context in which a convention is applied.
public class ConventionContext
- Inheritance
-
objectConventionContext
Constructors
ConventionContext(CommandLineApplication, Type?)
Initializes an instance of ConventionContext.
public ConventionContext(CommandLineApplication application, Type? modelType)
Parameters
applicationCommandLineApplicationThe application
modelTypeTypeThe type of the model.
Properties
Application
The application to which the convention is applied.
public CommandLineApplication Application { get; }
Property Value
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
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
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
ModelType
The type of the application model. Can be null when applied to CommandLineApplication instead of CommandLineApplication<TModel>.
public Type? ModelType { get; }