Does Funq IoC Container support property injection

2019-04-07 15:00发布

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条回答
Ridiculous、
2楼-- · 2019-04-07 15:40

Well wouldn't that generally go something like this?

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

        return myRepository;
    });
查看更多
登录 后发表回答