Service Fabric Autofac example for AspNet DotNetCore 3.1+
@alexmg is already working on this.
Since Oct 22, 2020.
Assessment
This issue has not been assessed yet.
Description
No examples on how to use Autofac in AspNet Core (DotNet Core 3.1+) web applications that run in Service Fabric
The repo at https://github.com/autofac/Examples/tree/master/src/ServiceFabricDemo/AutofacServiceFabricDemo hasn't been updated in 3 years. A lot has changed since then.
For instance, Startup.cs must have a void ConfigureServices(IServiceCollection services) method. Returning IServiceProvider is not valid anymore after DotNetCore 3.1+
I have created the following branch with a web app running the latest DotNetCore, that uses service fabric and Microsoft Dependency Injection. See here
It fulfills all the requirements (DI, reading appsettings, clean change of environment for testing, TestServer with possibility to overwrite DI registrations for mocks, etc.). Please feel free to have a look and if there's any way to add Autofac to that sample I'll be happy to contribute.
There are unanswered questions in StackOverflow about the same:
https://stackoverflow.com/questions/59980827/service-fabric-aspnet-core-3-1-autofac-webhostbuilder
https://stackoverflow.com/questions/64260534/how-to-use-service-fabric-service-with-aspnet-core-webapi-and-autofac-and-run-te
https://stackoverflow.com/questions/64278765/how-to-use-autofac-with-iwebhost
Desired Solution
A basic example on how to register Autofac with a WebHostBuilder (if possible), and where to register dependencies in a service fabric app would be enough.
Alternatives You've Considered
The alternative I've considered is not to use Autofac, but if I could help in any way to find out how to do it or to suggest something, I'll do that.
- Dominant language
- C#
- Stars
- 400
- Forks
- 347
- Avg merge
- 26m
- Merged PRs (30d)
- 9
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from autofac/Examples
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
enhancement help wanted
Difficulty 3/5 1-2 days Newbie friendliness 25/100
All issues in autofac/Examples
Similar issues
-
type/automation type/tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
t/bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
ci-failure-cause test-failure
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
area:auth FE mvp P3
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
klasolsson81/jobbliggaren#1788 ·