Skip to content

Make it easier to register custom services in the IoC container #1352

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

Merged
merged 2 commits into from
Oct 5, 2023

Conversation

bkoelman
Copy link
Member

@bkoelman bkoelman commented Oct 5, 2023

This PR makes app setup easier. Previously, you often had to register overrides after calling AddJsonApi (last one wins). With this change, order does not matter anymore. Note that the order of MVC filters still matters, it is unrelated to this change.

Samples have been updated to register before calling AddJsonApi, because that works now. And in integration tests, the ConfigureServicesBeforeStartup/ConfigureServicesAfterStartup methods have been collapsed into one.

Enumerable services are a bit more complicated, so I've added tests for that.

Closes #1347

QUALITY CHECKLIST

This makes app setup easier. Previously, you often had to register overrides *after* calling AddJsonApi (last one wins). With this change, order does not matter anymore. Note that the order of MVC filters still matters, it is unrelated to this change.
@codecov
Copy link

codecov bot commented Oct 5, 2023

Codecov Report

Merging #1352 (f179362) into master (8082765) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #1352   +/-   ##
=======================================
  Coverage   93.02%   93.02%           
=======================================
  Files         268      268           
  Lines        8802     8802           
=======================================
  Hits         8188     8188           
  Misses        614      614           
Files Coverage Δ
src/Examples/MultiDbContextExample/Program.cs 93.44% <100.00%> (ø)
src/Examples/NoEntityFrameworkExample/Program.cs 100.00% <100.00%> (ø)
...NetCore/Configuration/JsonApiApplicationBuilder.cs 100.00% <100.00%> (ø)
...DotNetCore/Configuration/ServiceDiscoveryFacade.cs 100.00% <100.00%> (ø)

@bkoelman bkoelman marked this pull request as ready for review October 5, 2023 23:08
@bkoelman bkoelman merged commit 050a33d into master Oct 5, 2023
@bkoelman bkoelman deleted the try-add-services branch October 5, 2023 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Use TryXXX in IoC registrations
1 participant