本文介绍了是否Funq IOC容器支持财产注射?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在寻找一个IoC容器我Compact Framework的应用程序中使用。试行Funq我注意到,我无法找到一个方法来做到物业注射用它。

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.

是否Funq支持地产注入?

Does Funq support Property Injection?

推荐答案

嗯那不是一般要这样呢?

Well wouldn't that generally go something like this?

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

        return myRepository;
    });

这篇关于是否Funq IOC容器支持财产注射?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-25 20:02