Jeninnet.FileQuery.DependencyInjection 1.2.1

Requires NuGet 6.0.0 or higher.

dotnet add package Jeninnet.FileQuery.DependencyInjection --version 1.2.1
                    
NuGet\Install-Package Jeninnet.FileQuery.DependencyInjection -Version 1.2.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Jeninnet.FileQuery.DependencyInjection" Version="1.2.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Jeninnet.FileQuery.DependencyInjection" Version="1.2.1" />
                    
Directory.Packages.props
<PackageReference Include="Jeninnet.FileQuery.DependencyInjection" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Jeninnet.FileQuery.DependencyInjection --version 1.2.1
                    
#r "nuget: Jeninnet.FileQuery.DependencyInjection, 1.2.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Jeninnet.FileQuery.DependencyInjection@1.2.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Jeninnet.FileQuery.DependencyInjection&version=1.2.1
                    
Install as a Cake Addin
#tool nuget:?package=Jeninnet.FileQuery.DependencyInjection&version=1.2.1
                    
Install as a Cake Tool

Jeninnet.FileQuery.DependencyInjection

GitHub Actions CI Workflow Status GitHub release GitHub contributors GitHub stars GitHub license

NuGet Version NuGet downloads

Dependency Injection bindings for Jeninnet.FileQuery.


✨ Repo Stats

Repobeats analytics image


This package integrates the Jeninnet.FileQuery engine into applications using Microsoft.Extensions.DependencyInjection. It registers internal parsing, compilation, and execution services.

Registered engines support the Phase 2 observability surface: async progress snapshots, opt-in match diagnostics, cancellation propagation, and configurable IO recovery strategies.


🚀 Installation

Install the Dependency Injection integration package via NuGet:

dotnet add package Jeninnet.FileQuery.DependencyInjection

🛠️ Usage Example

1. Service Registration

Register the subsystem on startup using ServiceCollectionExtensions.AddFileQuery:

using Microsoft.Extensions.Hosting;
using Jeninnet.FileQuery.DependencyInjection.Extensions;

var builder = Host.CreateApplicationBuilder(args);

// Registers the FileQuery engine and traversal services
builder.Services.AddFileQuery();

using var host = builder.Build();
await host.RunAsync();

2. Service Consumption

Inject IFileQueryEngine into your services:

using Jeninnet.FileQuery;

public sealed class ProjectScanner
{
    private readonly IFileQueryEngine _engine;

    public ProjectScanner(IFileQueryEngine engine)
    {
        _engine = engine;
    }

    public List<string> ScanRepository(string rootDirectory)
    {
        // Construct the query parameters
        var query = FileQuery.From(rootDirectory)
                             .Where("**", "!src/**/*.cs") // Ignore all except C# in src/
                             .Build();

        // Execute queries using the injected engine
        return _engine.Execute(query).ToList();
    }
}

3. Progress and Diagnostics with DI

var progress = new Progress<FileQueryProgress>(snapshot =>
{
    Console.WriteLine($"{snapshot.EntriesScanned} entries scanned");
});

var diagnostics = new Progress<FileQueryDiagnostic>(entry =>
{
    Console.WriteLine($"{entry.RelativePath}: {entry.Outcome}");
});

var query = FileQuery.From(rootDirectory)
                     .Where("**", "!src/**/*.cs")
                     .WithDiagnostics(diagnostics)
                     .WithErrorRecovery(FileQueryErrorRecoveryOptions.Retry(2))
                     .Build();

await foreach (var file in _engine.ExecuteAsync(query, progress, cancellationToken))
{
    Console.WriteLine(file);
}

⚙️ Service Registrations & Lifetimes

Calling AddFileQuery() registers the following components in the container:

Registered Interface Concrete Type Lifetime Purpose
IFileQueryEngine FileQueryEngine Singleton Primary engine executing queries.
IFileSystem FileSystem Singleton Decoupled platform IO actions.
ITraversalPlanBuilder TraversalPlanBuilder Singleton Prepares traversal steps.
ITraversalExecutor TraversalExecutor Singleton Drives physical/virtual path discovery.
IPatternCompilerRegistry PatternCompilerRegistry Singleton Manages compilers for different dialects.
PatternInvariantRegistry PatternInvariantRegistry Singleton Regulates dialect checks (e.g., wildcards, ranges).
PatternPipeline PatternPipeline Singleton Compiles raw inputs to matcher instructions.

🚫 Limitations

  • Singleton Lifetime: Registers matching components as Singletons. If your application requires transient mock filesystems or custom per-request traversal behaviors, register them manually instead of using AddFileQuery().
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.1 292 6/17/2026
1.2.0 302 6/17/2026
1.1.0 294 6/14/2026
1.0.0 303 6/2/2026