Dmitry Shechtman's Blog

December 13, 2014

AsyncActivator: Targeting Silverlight

This is an (unplanned) article in a series concerning AsyncActivator, a generalization of the .NET Asynchronous Factory pattern:

  1. Basics
  2. Cancellation
  3. Portability
  4. Silverlight

Dependency injection is quite a complex issue that garners a series of its own.

If you’ve been following this blog, you might have noticed that I’m a bit of a perfectionist. Although my latest article concluded:

Our portable AsyncActivator is now compatible with all platforms we’re aware of, save for legacy (i.e., non-Windows-Phone) Silverlight, which supports neither async/await (out of the box) nor reflection (to our requirements).

that little Silverlight box left unchecked kept bothering me. So with a little extra effort I made Ditto.AsyncInit and (some of) its upcoming child libraries compatible with Silverlight 5.

Now, don’t get me wrong. I’m fully aware of Silverlight’s current status — if it’s of any indication, Microsoft’s Immutable Collections library, released in mid-2013, targets every possible platform (including Xamarin), but not Silverlight.

However, that old dog can be taught the async/await trick, meaning many developers maintaining existing applications could benefit from asynchronous initialization having taken care of. If you happen to be a Silverlight developer with asynchrony in mind, you may find this article useful. Regardless of your plans of using any of the Ditto.AsyncInit components, you might still be interested in some of the challenges I encountered while making them compatible with Silverlight.

(more…)

Advertisements

Create a free website or blog at WordPress.com.