Suggestion for replacement of "StructureMap".
As the development of "StructureMap" has been discontinued, is there any good replacement for it?
Their website suggest using Lamar, but their current build seems to be failing, so I'm not very confident in adding it in my project.
Thanks!
AutoFac or SimpleInjector are two that I have gone with.
https://autofac.org/
https://simpleinjector.org/index.html
I'm planning on swapping in AutoFac. PR welcome if someone gets to it first.
Please excuse my ignorance but what makes the default .NET Core DI unfit for the job?
I guess that @ardalis wants to completely detach the infrastructure project from the web, binding the interfaces and implementations on runtime, but the built in DI doesn't allow that.
But I can be wrong.. ;)
@luizs81 that's one reason, yes, although you probably could achieve that, too. The main reason is that I like some of the features that other DI containers offer, such as default conventions/policies for wiring up types to interfaces. You can easily wire up all types that match this pattern: IFoo <-> Foo for instance, so that as long as you use that naming convention you don't need to remember to touch Startup every time you add another interface and service implementation. Many small projects don't need anything more than the built-in DI container but larger ones may benefit from the features offered by Autofac, et al.
@ardalis I didn't know that it was possible!
@ardalis Any reason you chose Autofac over Lamar, the replacement to Structuremap?
That's a good question. Mostly because I hadn't kept up with its progress and because Autofac I knew from when I wrote the ASP.NET Core Docs was a fully supported container from the 1.0 days. I should look into Lamar, though, especially since my first glance at it seems to indicate it's a) very much like StructureMap and b) designed to work closely with ASP.NET Core's DI system.
Thanks!