-
Notifications
You must be signed in to change notification settings - Fork 22
feat: Add Extension Method for adding global Hook via DependencyInjection #459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add Extension Method for adding global Hook via DependencyInjection #459
Conversation
Signed-off-by: Kyle Julian <[email protected]>
Signed-off-by: Kyle Julian <[email protected]>
src/OpenFeature.DependencyInjection/OpenFeatureBuilderExtensions.cs
Outdated
Show resolved
Hide resolved
src/OpenFeature.DependencyInjection/OpenFeatureBuilderExtensions.cs
Outdated
Show resolved
Hide resolved
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #459 +/- ##
==========================================
+ Coverage 86.47% 86.72% +0.25%
==========================================
Files 42 42
Lines 1671 1703 +32
Branches 177 179 +2
==========================================
+ Hits 1445 1477 +32
Misses 187 187
Partials 39 39 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Please look into the suggestions!
src/OpenFeature.DependencyInjection/OpenFeatureBuilderExtensions.cs
Outdated
Show resolved
Hide resolved
src/OpenFeature.DependencyInjection/OpenFeatureBuilderExtensions.cs
Outdated
Show resolved
Hide resolved
* This will allow consumers to easily add Hooks without forcing them to write a function everytime they do Signed-off-by: Kyle Julian <[email protected]>
I forgot to add it. Can you please update the |
Signed-off-by: Kyle Julian <[email protected]>
* Add unit tests to cover off new AddHook extension method Signed-off-by: Kyle Julian <[email protected]>
Signed-off-by: Kyle Julian <[email protected]>
…tion (open-feature#459) <!-- Please use this template for your pull request. --> <!-- Please use the sections that you need and delete other sections --> ## This PR <!-- add the description of the PR here --> - This adds a new OpenFeatureBuilder extension method to add global or not domain-bound hooks to the OpenFeature Api. ### Related Issues <!-- add here the GitHub issue that this PR resolves if applicable --> Fixes open-feature#456 ### Notes <!-- any additional notes for this PR --> We inject any provided Hooks as Singletons in the DI container. We use keyed singletons and use the class name as the key. Maybe we'd want to use a different name to avoid conflicts? I've done some manual testing with a sample weatherforecast ASP.NET Core web application ### Follow-up Tasks <!-- anything that is related to this PR but not done here should be noted under this section --> <!-- if there is a need for a new issue, please link it here --> ### How to test <!-- if applicable, add testing instructions under this section --> --------- Signed-off-by: Kyle Julian <[email protected]> Co-authored-by: André Silva <[email protected]> Signed-off-by: Weihan Li <[email protected]>
🤖 I have created a release *beep* *boop* --- ## [2.6.0](v2.5.0...v2.6.0) (2025-05-23) ### ✨ New Features * add AddHandler extension method to Dependency Injection package ([#462](#462)) ([ff414b8](ff414b8)) * Add Extension Method for adding global Hook via DependencyInjection ([#459](#459)) ([9b04485](9b04485)) * Add OTEL compatible telemetry object builder ([#397](#397)) ([6c44db9](6c44db9)) ### 🧹 Chore * Cleanup .props file ([#476](#476)) ([6d7a535](6d7a535)) * **deps:** update actions/attest-build-provenance action to v2.3.0 ([#464](#464)) ([0a5ab0c](0a5ab0c)) * **deps:** update codecov/codecov-action action to v5.4.3 ([#475](#475)) ([fbcf3a4](fbcf3a4)) * **deps:** update github/codeql-action digest to 60168ef ([#463](#463)) ([ea76351](ea76351)) * **deps:** update github/codeql-action digest to ff0a06e ([#473](#473)) ([af1b20f](af1b20f)) * **deps:** update spec digest to edf0deb ([#474](#474)) ([fc3bdfe](fc3bdfe)) ### 📚 Documentation * Add AspNetCore sample app ([#477](#477)) ([9742a0d](9742a0d)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Signed-off-by: OpenFeature Bot <[email protected]> Signed-off-by: André Silva <[email protected]> Co-authored-by: André Silva <[email protected]>
This PR
Related Issues
Fixes #456
Notes
We inject any provided Hooks as Singletons in the DI container. We use keyed singletons and use the class name as the key. Maybe we'd want to use a different name to avoid conflicts?
I've done some manual testing with a sample weatherforecast ASP.NET Core web application
Follow-up Tasks
How to test