5
I am migrating a Webapi project with . NET Framework 4.6 to . NET Core.
In this my project I use Unity to do Dependency Injection:
var container = new UnityContainer();
DependencyResolver = new UnityDependencyResolver(container);
container.RegisterType<IUserService, UserService>();
No . NET Core couldn’t use Unity the way I did in . NET 4.6 and found a solution to use this way, putting in my Startup.Cs
// DI Containers Registration
services.AddTransient<IUserService, UserService>();
What would be the best practice today in . NET Core for Dependency Injection, it is worth using some component like Structuremap, Castlewindsor.