What IoC should be used in cross-platform applications (Xamarin)?

I am creating a cross-platform application for Windows, OSX, iOS, Windows Mobile, Android and the Internet in ASP.NET. For each client I use C # (I use Xamarin). All in one VS solution. My main code (domain) is in the Class Library (portable) , so it can be used in every user interface (Client).

I want to use the IoC container in this project, and here is my problem: I don’t know if IoC will be selected, will work in every client. I know that, for example, Ninject does not work in a portable class library - for such a project, there is Ninject.Portable. This made me wonder if it is possible that the IoC that I choose will not work in one of my Clients, which will be bad.

So my question is: What kind of IoC containers can I use in portable class libraries and in every client (UI) run in Visual Studio 2015?

I was interested in a simple injector , but now I have these doubts.

+7
c # dependency-injection inversion-of-control xamarin
source share
2 answers

I wrote a small layer of abstraction on IoC containers and container plugins that work with Xamarin. They are available on NuGet:

https://www.nuget.org/packages?q=xlabs.ioc

Testable containers ( unit tests are on GitHub ):

  • Autofac
  • Ninject
  • Simpleinjector
  • Tinyioc
  • Unity

Matt Whiton has written an excellent usage guide .

+9
source share

There is an IoC container that works with Xamarin called SystemDot. This is on nuget.

0
source share

All Articles