Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Funq IoC Container support property injection?

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?

like image 961
Michał Drozdowicz Avatar asked Jun 29 '10 09:06

Michał Drozdowicz


People also ask

What are the containers used for dependency injection?

The IoC container that is also known as a DI Container is a framework for implementing automatic dependency injection very effectively. It manages the complete object creation and its lifetime, as well as it also injects the dependencies into the classes.

What is dependency injection and IoC container?

Inversion of Control(IoC) is also known as Dependency injection (DI). The Spring container uses Dependency Injection (DI) to manage the components that build up an application and these objects are called Spring Beans. Spring implements DI by either an XML configuration file or annotations.

How many way IoC can do dependency injection?

There are three types of dependency injection — constructor injection, method injection, and property injection.

Are dependency injection and IoC same?

Dependency Injection is the method of providing the dependencies and Inversion of Control is the end result of Dependency Injection. IoC is a design principle where the control flow of the program is inverted. Dependency Injection is one of the subtypes of the IOC principle.


1 Answers

Well wouldn't that generally go something like this?

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

        return myRepository;
    });
like image 151
herzmeister Avatar answered Nov 12 '22 08:11

herzmeister