• About
  • Privacy Policy
  • Utilities
Darchuk.NET

AutoFac

Autofac–Automatically registering generics via constructors

May 17, 2019 by Robert Leave a Comment

Recently I had a situation where I had a class and interface to make a generic service which would do something based on whatever type is provided.  (Obviously, it was not so contrived…) These would then get injected to other classes to be used as necessary: Which works fine… as long as you remember to … [Read more…]

Posted in: .NET Core, C#, Reflection Tagged: .NET, AutoFac, C#, Csharp, DependencyInjection, Generics, IoC, Reflection

Extending Autofac Modules

May 10, 2019 by Robert 1 Comment

Autofac is a popular dependency injection library that I like to use because they’ve done a lot of legwork to get things to work nicely in .NET Core – (some DI frameworks were not happy with Microsoft’s decision to make a public abstraction for their own DI library). Modules If you have a big solution … [Read more…]

Posted in: .NET Core, C# Tagged: .NET, AutoFac, C#, DependencyInjection, DI

Automatically registering properties as implementations in AutoFac

May 25, 2018 by Robert Leave a Comment

In this post I talked about building out a configuration service that could be split into various areas of concerns so that each piece can be injected where it makes sense (without all of the noise of the rest of the configuration). Previously, the registration looked like this: Reflection With reflection, we can loop through … [Read more…]

Posted in: .NET Core, C#, IoC, Reflection Tagged: AutoFac, C#, Configuration, DI, IoC, Reflection

Autofac.Extras.Moq AutoMock

March 23, 2018 by Robert Leave a Comment

Unit testing can be annoying.  Sometimes it feels like setting up a delicate house of cards in just the right way and hoping that nobody opens a window to let a breeze knock the whole thing over. If you’re using inversion of control (and you should be), its a little easier because you can use … [Read more…]

Posted in: .NET Core, C#, IoC, Unit Testing Tagged: AutoFac, C#, Mock, Moq, unit testing

AutoFac registering properties as implementations

January 5, 2018 by Robert 1 Comment

Recently I’ve been building out something that is very configurable.  Tons of different settings, switches, numbers… you name it.  Its nice to have things split out into areas of concern – that is, different interfaces identifying the configuration settings pertinent to a particular thing – but then you end up with all of these things … [Read more…]

Posted in: C#, IoC Tagged: AutoFac, C#, Configuration, DI, IoC

Recent Posts

  • Allowing trailing JSON commas in ASP.NET Core 3
  • YADNC3JSG–Yet Another .NET Core 3.0 JSON Serializer Gotcha
  • Logging in a .NET Core 3 SignalR client
  • .NET Core 3 unit testing project sdk
  • .NET Core 3.0 Upgrade–New JSON Serializer Gotchas

Recent Comments

  1. Robert on C# Setting Socket Keep-Alive
  2. Oliver Schramm on C# Setting Socket Keep-Alive
  3. John Anderson on Waiting for a keypress asynchronously in a C# console app
  4. Ronald Garlit on .NET Core 3 unit testing project sdk
  5. Ronald Garlit on .NET Core 3 unit testing project sdk

Copyright © 2025 Darchuk.NET.

Omega WordPress Theme by ThemeHall