FractalDataWorks.Roslyn.Commands 0.4.0-preview.6

This is a prerelease version of FractalDataWorks.Roslyn.Commands.
The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package FractalDataWorks.Roslyn.Commands --version 0.4.0-preview.6
                    
NuGet\Install-Package FractalDataWorks.Roslyn.Commands -Version 0.4.0-preview.6
                    
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="FractalDataWorks.Roslyn.Commands" Version="0.4.0-preview.6" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FractalDataWorks.Roslyn.Commands" Version="0.4.0-preview.6" />
                    
Directory.Packages.props
<PackageReference Include="FractalDataWorks.Roslyn.Commands" />
                    
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 FractalDataWorks.Roslyn.Commands --version 0.4.0-preview.6
                    
#r "nuget: FractalDataWorks.Roslyn.Commands, 0.4.0-preview.6"
                    
#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 FractalDataWorks.Roslyn.Commands@0.4.0-preview.6
                    
#: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=FractalDataWorks.Roslyn.Commands&version=0.4.0-preview.6&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=FractalDataWorks.Roslyn.Commands&version=0.4.0-preview.6&prerelease
                    
Install as a Cake Tool

FractalDataWorks.Roslyn.Commands

Provides the command handler infrastructure for executing Roslyn commands against a workspace. This package contains the RoslynCommandHandler and TranslatorRegistry implementations.

Overview

This package implements the command execution pipeline defined in FractalDataWorks.Roslyn.Commands.Abstractions. It orchestrates command execution by:

  1. Looking up the appropriate translator for a command type
  2. Executing the translator against the current workspace solution
  3. Applying mutations back to the workspace if needed

Installation

<PackageReference Include="FractalDataWorks.Roslyn.Commands" Version="1.0.0" />

Target Framework: net10.0

Usage

Service Registration

From ServiceCollectionExtensions.cs:18-29:

public static IServiceCollection AddRoslynCommandHandler(this IServiceCollection services)
{
    if (services is null)
    {
        throw new ArgumentNullException(nameof(services));
    }

    services.TryAddSingleton<ITranslatorRegistry, TranslatorRegistry>();
    services.TryAddScoped<IRoslynCommandHandler, RoslynCommandHandler>();

    return services;
}

Custom Translator Configuration

From ServiceCollectionExtensions.cs:37-61:

public static IServiceCollection AddRoslynCommandHandler(
    this IServiceCollection services,
    Action<ITranslatorRegistry> configureRegistry)
{
    if (services is null)
    {
        throw new ArgumentNullException(nameof(services));
    }

    if (configureRegistry is null)
    {
        throw new ArgumentNullException(nameof(configureRegistry));
    }

    services.AddSingleton<ITranslatorRegistry>(sp =>
    {
        var registry = new TranslatorRegistry();
        configureRegistry(registry);
        return registry;
    });

    services.TryAddScoped<IRoslynCommandHandler, RoslynCommandHandler>();

    return services;
}

Registering Translators

From ServiceCollectionExtensions.cs:69-81:

public static IServiceCollection AddTranslator<TTranslator>(this IServiceCollection services)
    where TTranslator : class, IRoslynCommandTranslator
{
    if (services is null)
    {
        throw new ArgumentNullException(nameof(services));
    }

    services.AddSingleton<IRoslynCommandTranslator, TTranslator>();
    services.AddSingleton<TTranslator>();

    return services;
}

API Reference

RoslynCommandHandler

From RoslynCommandHandler.cs:17-37:

public sealed class RoslynCommandHandler : IRoslynCommandHandler
{
    private readonly IRoslynWorkspace _workspace;
    private readonly ITranslatorRegistry _translators;
    private readonly ILogger<RoslynCommandHandler> _logger;

    public RoslynCommandHandler(
        IRoslynWorkspace workspace,
        ITranslatorRegistry translators,
        ILogger<RoslynCommandHandler>? logger = null)
    {
        _workspace = workspace ?? throw new ArgumentNullException(nameof(workspace));
        _translators = translators ?? throw new ArgumentNullException(nameof(translators));
        _logger = logger ?? NullLogger<RoslynCommandHandler>.Instance;
    }
}

TranslatorRegistry

From TranslatorRegistry.cs:11-13:

public sealed class TranslatorRegistry : ITranslatorRegistry
{
    private readonly ConcurrentDictionary<Type, IRoslynCommandTranslator> _translators = new();

Dependencies

Package Purpose
FractalDataWorks.Roslyn.Commands.Abstractions Command and translator interfaces
FractalDataWorks.Workspace.Roslyn Workspace management
Microsoft.Extensions.Logging.Abstractions Logging infrastructure
Microsoft.Extensions.DependencyInjection.Abstractions DI registration

License

Apache-2.0

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 (2)

Showing the top 2 NuGet packages that depend on FractalDataWorks.Roslyn.Commands:

Package Downloads
CyberdyneDevelopment.Mc3Po.Tools.Adapters

Development tools and utilities for the FractalDataWorks ecosystem. Build:

CyberdyneDevelopment.DeveloperTools.McpServer

Development tools and utilities for the FractalDataWorks ecosystem. Build:

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
Loading failed