Hi folks,
I've got a greedy constructor defined for my Controllers. Each controller requires an ILoggingService instance. Now my dependency injection (which is StructureMap .. but if you don't use that, please keep reading) works fine .. but I wish to make it that the ILoggingService
greedy constructor requires a String
. This value will be the fully qualified name of the Controller .. or some text (if that's too hard).
eg Current code..
public AccountController(IAccountService accountService,
ILoggingService loggingService) { ... }
eg Wishful pseduo code...
public AccountController(IAccountService accountService,
ILoggingService loggingService(this.GetType().ToString()
.. or hardcod "X.Y..AccountController")
{ ... }
is this possible? I'm guessing I might have to define something tricky in the registry / bootstrap?
NOTE: I've tried using reflection but this doesn't work because the IoC uses an Instance Builder thingy which generates a unique object name for each injected instance.
Please help!