Skip to content
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

Why is this repo using AutoFac instead of .NET's own DI infrastructure? #649

Closed
Tony20221 opened this issue Dec 11, 2023 · 3 comments
Closed

Comments

@Tony20221
Copy link

Why is this repo using AutoFac instead of .NET's own DI infrastructure?

If the repo had a discussion or a question area, I could have asked this question there. Also, I don't think Stackoverflow is the right place to ask this question since it's pretty much directed to the author.

@ardalis
Copy link
Owner

ardalis commented Dec 14, 2023

Hi @Tony20221 this is fine to ask here. I'm not turning on Discussions mainly because I don't want one more place to have to check.

To answer your question, and probably this would be a good opportunity to include an ADR, I used Autofac when the .NET DI container was still pretty new and not full-featured. I've used Autofac for longer than .NET Core has existed, and it's a very mature and stable library that has a lot of nice capabilities. Being able to put modules close to the dependencies (in the same project as the implementation classes) is one such capability, though of late it seems the de facto .NET standard is to achieve something similar using extension methods. Autofac also has nicer support for things like decorators, but out of the box I'm not using that capability here.

To be honest I have been considering removing Autofac from this template for a while now. I'm not sure it adds enough to support the extra files and concepts and dependencies it brings. I'm curious to know how others feel about that. Leave a comment or a 👍 or 👎 on this comment to show you prefer Autofac (👍 ) or not (👎 ).

@ardalis
Copy link
Owner

ardalis commented Feb 29, 2024

Yeah, the votes are pretty evident here. I'm going to remove Autofac.

@KyleMcMaster
Copy link
Collaborator

KyleMcMaster commented Mar 1, 2024

Just to add my 2 cents, I agree that an ADR would be good to add for this decision and it's important to note that community feedback was considered for the change (especially since it was overwhelmingly weighted to one outcome).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants