open-feature / open-feature/cli

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

Open
#210 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
63
Forks
22
Avg merge
1h 27m
Merged PRs (30d)
19

Description

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

  • Builds upon #208 which provides a quick-fix for DI issues using .NET Standard as a first step
  • This issue represents the longer-term, more comprehensive solution

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the .NET generator and the generated project output, then review #208 and the current OpenFeature.DependencyInjection and OpenFeature.Hosting recommendations. Compare the package-reference and service-registration alternatives described here. Done means generated projects use the selected official package and extension-method registration pattern while addressing the DI concerns in #208.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.