Does Funq IoC Container support property injection

2019-04-07 14:45发布

问题:

I'm looking for an IoC container to use in my Compact Framework application. Trying out Funq I noticed that I can't find a way to do Property Injection with it.

I've looked through the discussion on the project's site and the unit tests for it, but I can't find any example of Property Injection.

Does Funq support Property Injection?

回答1:

Well wouldn't that generally go something like this?

myContainer.Register<IUserRepository>(() =>
    {
        var myRepository = new SomeUserRepository();
        myRepository.SomeProperty = someValue;

        return myRepository;
    });