Skip to content

Example app for paramters object#598

Open
linglingye001 wants to merge 1 commit intomainfrom
linglingye/example-app-parameters-object
Open

Example app for paramters object#598
linglingye001 wants to merge 1 commit intomainfrom
linglingye/example-app-parameters-object

Conversation

@linglingye001
Copy link
Copy Markdown
Member

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new console sample that demonstrates using FeatureFilterConfiguration.ParametersObject to supply strongly-typed filter settings directly from a custom IFeatureDefinitionProvider, avoiding IConfiguration-based parameter binding.

Changes:

  • Introduces ParameterObjectConsoleApp example project with a top-level Program.cs that evaluates a targeting-based feature for multiple users.
  • Adds an InMemoryFeatureDefinitionProvider that returns a FeatureDefinition whose filter settings are provided via ParametersObject.
  • Documents the concept and usage in a new sample README.md.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
examples/ParameterObjectConsoleApp/README.md Documents the new ParametersObject-based sample and how to run it.
examples/ParameterObjectConsoleApp/Program.cs Implements the sample’s runtime evaluation loop using ContextualTargetingFilter.
examples/ParameterObjectConsoleApp/ParameterObjectConsoleApp.csproj Defines the new .NET 8 console app project and references the main library.
examples/ParameterObjectConsoleApp/InMemoryFeatureDefinitionProvider.cs Provides in-memory feature definitions using ParametersObject for targeting settings.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +72 to +73

await Task.CompletedTask;
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GetAllFeatureDefinitionsAsync is implemented as an async iterator but only awaits Task.CompletedTask at the end, which is redundant and adds noise. Consider removing the trailing await (and/or dropping async if you switch to a non-async implementation) so the method is a straightforward async iterator.

Suggested change
await Task.CompletedTask;

Copilot uses AI. Check for mistakes.
//
using Microsoft.FeatureManagement;
using Microsoft.FeatureManagement.FeatureFilters;
namespace ParameterObjectConsoleApp
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The folder/project/namespace name uses ParameterObject... (singular) while the API being demonstrated is ParametersObject (plural). Consider aligning the example name with the public API name to reduce confusion when users search for it.

Suggested change
namespace ParameterObjectConsoleApp
namespace ParametersObjectConsoleApp

Copilot uses AI. Check for mistakes.
## Running

```
dotnet run
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The running instructions are ambiguous from the repo root (plain dotnet run will likely execute a different project or error). Consider updating this section to either include a cd examples/ParameterObjectConsoleApp step or use dotnet run --project examples/ParameterObjectConsoleApp/ParameterObjectConsoleApp.csproj.

Suggested change
dotnet run
dotnet run --project examples/ParameterObjectConsoleApp/ParameterObjectConsoleApp.csproj

Copilot uses AI. Check for mistakes.
Comment on lines +10 to +15
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.1" />
<PackageReference Include="System.Text.Json" Version="8.0.5" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
</ItemGroup>

<ItemGroup>
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The project references configuration/JSON/DI packages, but this example doesn't use IConfiguration, JSON serialization, or DI. Consider removing these PackageReferences to keep the sample minimal (the FeatureManagement project reference already brings in what it needs transitively).

Suggested change
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.1" />
<PackageReference Include="System.Text.Json" Version="8.0.5" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
</ItemGroup>
<ItemGroup>

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants