https://github.com/mendhak/dotnet-core-dependency-injection-connection-string
Sample repo - inject a different connection string based on URL path
https://github.com/mendhak/dotnet-core-dependency-injection-connection-string
Last synced: 9 months ago
JSON representation
Sample repo - inject a different connection string based on URL path
- Host: GitHub
- URL: https://github.com/mendhak/dotnet-core-dependency-injection-connection-string
- Owner: mendhak
- Created: 2021-06-29T22:32:19.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-06-30T06:58:32.000Z (over 4 years ago)
- Last Synced: 2025-02-12T06:38:48.166Z (11 months ago)
- Language: C#
- Size: 10.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
```
dotnet run
```
Then, browse to
https://localhost:5001/v1/WeatherForecast
and see the console output
Then browse to
https://localhost:5001/v2/BetterWeatherForecast
And see the console output
Go to [Startup.cs](Startup.cs#L41) to see how it's done.
Look at the [Helper Resolver](Helper/HelperResolverService.cs), note the IHttpContextAccessor being injected.