Property Injection

Jun 29, 2010 at 10:08 AM

Hi.

Does Funq support Property Injection?

Coordinator
Jun 29, 2010 at 10:20 PM
Sure thing! Because you're registering the object construction yourself, you can use object initializer syntax to initialize property dependencies too. There's no magic auto-wiring or any reflection going on. Just plain "old" lambda "magic".
Jun 29, 2010 at 11:02 PM

Ok. So in a case when I want the container to resolve the property dependency, I would just write:

container.Register<IFoo>(c => new Foo(){Bar = c.Resolve<IBar>()});

Is that right?

 

Coordinator
Jun 29, 2010 at 11:04 PM
precisely :)