Skip to content

NexusLabs.Needlr.Generators

NexusLabs.Needlr.Generators Namespace

Classes
GenerateFactoryAttribute Generates a factory for this type, allowing runtime parameters to be specified while auto-injecting the rest from the service provider.
GenerateFactoryAttribute<TInterface> Generates a factory for this type that returns the specified interface type, allowing runtime parameters to be specified while auto-injecting the rest from the service provider.
GenerateTypeRegistryAttribute Marks an assembly for compile-time type registry generation. The source generator will scan all referenced assemblies and generate a TypeRegistry class containing all injectable types.
HttpClientOptionsAttribute Marks a class as a named HttpClient configuration type. The source generator will emit both an AddOptions<T>().BindConfiguration(...) call and a matching services.AddHttpClient(name, (sp, client) => { ... }) registration, so consumers never have to hand-write either one.
NeedlrSourceGenBootstrap Runtime bootstrap registry for source-generated Needlr components.
OpenDecoratorForAttribute Marks a generic class as a decorator for all closed implementations of an open generic interface. This is a source-generation only feature - the generator discovers all closed implementations at compile time and emits decorator registrations for each.
OptionsAttribute Marks a class as an options/configuration type that should be bound to a configuration section. The source generator will automatically generate the services.Configure<T>() call.
ProviderAttribute Marks an interface or partial class as a Provider - a strongly-typed service locator.
ValidationError Represents a validation error with optional structured information.
ValidatorProviderAttribute Marks an assembly as providing a validator base type that the Needlr analyzer should recognize. When a type used with [Options(Validator = typeof(...))] inherits from the specified base type, the analyzer will not report NDLRGEN014 (validator missing interface).
Structs
InjectableTypeInfo Represents metadata about an injectable type discovered at compile time.
PluginTypeInfo Represents metadata about a plugin type discovered at compile time.
Interfaces
IHttpClientBaseAddress Capability interface declaring that a named HttpClient options type configures System.Net.Http.HttpClient.BaseAddress. When implemented, the source generator emits client.BaseAddress = options.BaseAddress; into the generated AddHttpClient callback, guarded by a null check so a null value leaves the client unchanged.
IHttpClientDefaultHeaders Capability interface declaring that a named HttpClient options type configures arbitrary default request headers. When implemented, the source generator emits a foreach loop into the generated AddHttpClient callback that calls client.DefaultRequestHeaders.Add(kvp.Key, kvp.Value) for each entry, guarded by a null check on the dictionary.
IHttpClientTimeout Capability interface declaring that a named HttpClient options type configures System.Net.Http.HttpClient.Timeout. When implemented, the source generator emits client.Timeout = options.Timeout; into the generated AddHttpClient callback.
IHttpClientUserAgent Capability interface declaring that a named HttpClient options type configures the User-Agent default request header. When implemented, the source generator emits a client.DefaultRequestHeaders.UserAgent.ParseAdd(options.UserAgent) call into the generated AddHttpClient callback, guarded by a null/empty check.
INamedHttpClientOptions Marker interface for types decorated with HttpClientOptionsAttribute. Every [HttpClientOptions] target must implement this interface; the NDLRHTTP001 analyzer diagnostic enforces it at compile time.
IOptionsValidator<T> Interface for validating options types.
IStandardHttpClientOptions Convenience aggregate interface that composes all v1 capability interfaces for a named HttpClient: the INamedHttpClientOptions marker plus IHttpClientTimeout, IHttpClientUserAgent, IHttpClientBaseAddress, and IHttpClientDefaultHeaders.
Enums
FactoryGenerationMode Controls what factory artifacts are generated for types marked with GenerateFactoryAttribute.
InjectableLifetime Specifies the lifetime of a service in the dependency injection container.
ValidationSeverity Specifies the severity of a validation error.