Skip to content

feat(dotnet): leverage OpenFeature.DependencyInjection package for improved code generation #210

@tomflenner

Description

@tomflenner

Summary

Enhance the .NET code generator to leverage the latest improvements from openfeature/dotnet-sdk, specifically using OpenFeature.DependencyInjection or OpenFeature.Hosting packages to generate code that better aligns with modern .NET dependency injection patterns and the SDK's recommended practices.

Motivation

The current generated code doesn't fully embrace the DI-first philosophy of the underlying OpenFeature SDK. By utilizing the official DI packages, we can:

  • Generate code that follows .NET best practices and conventions
  • Provide better integration with ASP.NET Core and other .NET hosting scenarios
  • Reduce boilerplate and improve developer experience
  • Ensure generated code stays aligned with SDK evolution and recommendations

Proposed Solution

Update the dotnet generator to:

  1. Include OpenFeature.DependencyInjection or OpenFeature.Hosting package references in generated projects
  2. Generate service registration code using OpenFeature.DependencyInjection or OpenFeature.Hosting with extension methods

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions