Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IoC container for Portable Class Libraries

Is there any IoC container out there which supports (or can be made to) the Portable Class Libraries yet?

I fiddled around with some (SimpleInjector, AutoFac) but they always had one dependency or another which prevented me from using them as a portable class library.

I'm fairly new to the topic so I maybe totally on the wrong track here.

In more detail:

I want to create a library containing my models (and later viewmodels) for a MMVM app which should run on .Net 4.5, WP7 and WinRT. This models should be saveable as files. Since the implementation of the particular save algorithms (desktop filesystem, isolated storage) is specific to every platform I hoped to utilize an IoC container to decouple it from the models themselves.

like image 932
Amenti Avatar asked Mar 03 '12 07:03

Amenti


People also ask

Is MEF an IoC container?

No, it is otherwise. IoC is a broad concept and DI is the design pattern to implement the core of IoC. MEF is some form of DI, but it has not all fundamental features of IoC. MEF uses composition to find out the dependencies it needs to resolve.

What is the purpose of an IoC container?

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?

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

I believe there is a beta of autofac for portable libraries: http://code.google.com/p/autofac/downloads/detail?name=Autofac-2.6.1.841-Portable.zip

like image 164
Foo42 Avatar answered Sep 28 '22 01:09

Foo42