15

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

alexandrul
  • 12,856
  • 13
  • 72
  • 99
Ross Hambrick
  • 5,880
  • 2
  • 43
  • 34

6 Answers6

16

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

chrisntr
  • 2,208
  • 20
  • 28
4

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/

Adam
  • 4,159
  • 4
  • 32
  • 53
  • Do you remember which one, and how you evaluated them? – Alxandr Jun 23 '11 at 07:24
  • Sorry, I cant recall which ones I tested. I just plugged them into my application an tried to achieve the level of functionality I needed, and evaluated how much 'fudging' was required for each library. As mentioned - Funq was really easy to use, and provided everything I needed. – Adam Jun 24 '11 at 03:42
2

take a look on TikoContainer. Pretty easy to use

Sedot
  • 21
  • 2
1

The OpenNETCF IoC container now supports MonoTouch as well.

ctacke
  • 66,480
  • 18
  • 94
  • 155
0

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.

Ben
  • 6,023
  • 1
  • 25
  • 40
  • From the docs it looks like it has only Attribute-based configuration. Is it true? – Shaddix Oct 28 '13 at 02:30
  • Yes, explicitly so. It's designed to use compile-time codegen to get around restrictions on iOS that hinder current IoC containers, and so isn't very configurable at runtime - beyond Container.Add(Container), that is. – Ben Oct 28 '13 at 18:01
0

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.)

Big Rich
  • 5,864
  • 1
  • 40
  • 64
  • Why the down vote? If you have information to the contrary that Spring.Net can't be used with Monotouch, please update this page to let everybody know that. Otherwise, my "suggestion" is still a valid one, no? – Big Rich Jul 19 '12 at 14:25