https://github.com/alsami/autofac_test
https://github.com/alsami/autofac_test
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/alsami/autofac_test
- Owner: alsami
- Created: 2019-10-16T15:34:11.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-10-15T19:30:51.000Z (over 6 years ago)
- Last Synced: 2025-06-27T05:45:06.001Z (about 1 year ago)
- Size: 6.84 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
## requirements
netcore 3.0
## how to run
```
git clone git@github.com:wmaryszczak/autofac_test.git
cd autofac_test
dotnet run
```
## test1
It throws `DependencyResolutionException` while resolving controller contructor's deps.
`action:`
GET http://localhost:5000/test1
`current behaviour:`
unable to resolve dependencies regsistered via MultitenantContainer
`expected behaviour:`
all dependencies are resolved from root container because of `services.AddControllersAsServices()` inside Starup.cs
## test2
Autofac does not respect declared lifecycle on registration phase
`action:`
GET http://localhost:5000/test2
`current behaviour:`
dependencies are resolved explicitly from MultitenantContainer, but its lifetime is not respected. `InstancePerLifetimeScope` dependencies acts as singleton.
`expected behaviour:`
`InstancePerLifetimeScope` is respected, so Dispose must be called after http request finish for deps. resistreder in MultitenantContainer (class: `DepPerTenant`) and in root container (class: `DepScoped`)
## test3
Everything work fine, only because I do not resolve any tenant register dependency
`action:`
GET http://localhost:5000/test3
## hint
Each dependency print its lifecycle on the console output.