Unity InjectionConstructor for multiparam constructor overriding only single one

Unity can’t do this out of the box. The best you can do is:

container.RegisterType<Bar>(
    new InjectionConstructor(
        typeof(IFoo), typeof(IFoo2), typeof(IFoo3), typeof(IFooN), "123"));

Or you can use the SmartConstructor provided by the TecX project. This blog post describes some background.

Registration would look like this:

container.RegisterType<Bar>(new SmartConstructor("text", "123"));

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)