Hacker News new | ask | show | jobs
by mieseratte 2461 days ago
Having just come into a .NET shop in the last couple months, having spent much time with Spring / Java the documentation and clarity of what to use is troublesome. I really expected Microsoft to have great documentation, but sadly I’ve not found it great.

So far I’ve done some WCF SOAP work, and an ASP.NET MVC 5 application. Figuring out what the latest frameworks and tools is a bit of legwork. Things aren’t always clear, and not always well integrated.

Figuring out authentication was not clear, whether to use Membership, Identity, where OWIN fit into the picture. If you need custom authentication finding details is hard. Ultimately I figured it out, but it’s clear as mud from a fresh eyes standpoint.

Then setting up DI, which container? Well I had Core DI available, figured that would be a good choice. Except I have to write a good bit of glue code to make it work.

I’m definitely enjoying C# as a language and the standard library. But the ecosystem is a bit clunky.

2 comments

If you want a more batteries-included less-glue-requiring IoC container, can't recommend Autofac enough. Always up-to-date, responsive developers, thorough documentation. I chose it over ten years ago after reading https://www.manning.com/books/dependency-injection-in-dot-ne...? and have never looked back.
its very simple to get .net core DI working, shouldn't be much code other than registering your types / service.

await new HostBuilder().ConfigureServices((context, services) => { // services.AddTransient.... }).UseConsoleLifetime().Build.RunAsync()

I’m talking DI for ASP.NET MVC 5, non-Core.

That required a custom provider (trivial), and non-obviously a custom ControllerFactory as I picked Core DI instead of a more fully-fledged solution.

Unfortunately there is very little obviousness in documentation and germs often get conflated and confused. Perhaps this is MS trying to get me to take one of their infamous certification courses?

That is because MVC 5 did not support DI out of the box. This has been fixed with Core. It is quite easy now, since I was able to figure it out haha.