IoC library compatible with MonoTouch?

2019-02-08 11:37发布

问题:

Still getting familiar with the limits of MonoTouch. Is there an IoC/DI library that can be used with MonoTouch. Something like Ninject ideally?

回答1:

Give TinyIoC a try - http://www.grumpydev.com/2010/03/02/announcing-tinyioc-an-easy-to-use-hassle-free-inversion-of-control-container/

Cheers,

ChrisNTR



回答2:

I went through this evaluation process, and I found that Funq was a nice clean implementation that gave me enough power to do what I wanted without over complicating things (or dragging is massive dependencies). It's nice and clean, and supports lazy object initialization through lambda expressions.

I evaluated 5 or 6 different containers specifically for use with MonoTouch.

http://funq.codeplex.com/



回答3:

take a look on TikoContainer. Pretty easy to use



回答4:

The OpenNETCF IoC container now supports MonoTouch as well.



回答5:

Thought I'd mention Spring.Net, we use the original [Java] version extensively in all our applications.

Spring [on Java, at least] has many. many [optional] modules. I haven't tried the .Net version myself, but I'm interested to find out how it compares.

Cheers

Rich

P.S. Spring.Net is Apache licensed, so its usable in closed source, commercial projects (think iOS/iPhone etc.)



回答6:

I've released Stiletto, an IoC that works on all .NET platforms, including Xamarin and MonoTouch. It lets you specify your dependencies mainly using attributes, and gets around limitations on runtime reflection and generic instantiations by doing its thing at compile-time.

EDIT

I'll have to update the docs, but the pre-compile tool does not work with the current build tools in Xamarin Studio. Stiletto pre-compilation requires xbuild, which is supported for Xamarin.Android but not for Xamarin.iOS! Unfortunately, this means that my answer is mostly incorrect - that is, unless you want to write iOS apps in Visual Studio, which is what I'd been doing! Apologies. Will delete this answer in a few days.