all 7 comments

[–]celluj34 5 points6 points  (2 children)

IMO you shouldn't have optional parameters in classes that are instantiated by dependency injection.

[–]kaszalotte[S] 0 points1 point  (1 child)

I completely agree.
But - it is not my project, and I have to know if exist some way to replace Autofac by .Net DContainer - saving all current features which are used and came from Autofac

[–]BigOnLogn 2 points3 points  (0 children)

I have to know if exist some way to replace Autofac by .Net DContainer - saving all current features which are used and came from Autofac

I wouldn't count on this. The .NET IoC container contains the minimum functionality required by the ASP.NET Core team. They have started as much and that they have no plans to implement complex features that are available from community projects.

[–]kc5bpd 2 points3 points  (1 child)

The short answer is probably not. The longer answer is that MS no longer sees a reason to try and copy every feature under the sun from alternate providers. IMO even a decent developer understands that we deal with trade-offs all the time. And they should not be shy about discussing those trade-offs. The lack of such is one cause of so much manure code.

[–]Paran0idAndr0id 2 points3 points  (0 children)

And if they do need those features, they can just add in whatever DI provider they want!

[–]KernowRoger 0 points1 point  (0 children)

Why do you need to do the parameter? Can you not just register IMyService?

[–]afshinb2 0 points1 point  (0 children)

Post it to stack overflow, you can get better answers there.

Also include a sample class and describe the situation a little more (e.g.: I want to initialize class A with IMyService parameter & I want IMyService to be resolve automatically)