IoC on Silverlight
A number of IoC containers have Silverlight versions - Ninject and Unity especially seem to have healthy Silverlight offerings. Silverlight 2.0 is a variant of the .NET runtime, so this isn't too surprising.
Thanks to Tyson Stolarski and Rinat Abdullin, Autofac recently joined their ranks with a Silverlight-compatible build. (This one is hot off the press, so test it thoroughly before you set out to build anything mission-critical :))
MEF hasn't released any concrete plans for Silverlight, but experimenters can probably coerce the Codeplex source into a compatible build by hacking the .csproj file.
If you're reading this blog and use IoC on Silverlight in one form or another:
- What have your experiences been like?
- Do you use IoC in the UI, the 'back-end' or both?
- Does loose coupling/runtime composition get in the way of XAML-based designers?
I'd love to hear your thoughts!
Comments
Anonymous
January 04, 2009
If you're interested in what was required to get Autofac to build on Silverlight, Rinat has kindly written about the experience here: http://rabdullin.com/journal/2009/1/4/how-to-target-multiple-net-frameworks.htmlAnonymous
January 10, 2009
I've been using Ninject all over the applications, ViewModels, Views, Services, Models, etc... I think it's a great tool. I mainly followed the example of Jonas (http://jonas.follesoe.no/YouCardRevisitedImplementingDependencyInjectionInSilverlight.aspx) with some custom tweaks. It's great that we can provide a good design time experience. Also for testing purposes we have been able to easily mock dependencies.Anonymous
May 29, 2011
This link seams to work jonas.follesoe.no/.../youcard-re-visited-implementing-dependency-injection-in-silverlight