Skip to content

Instantly share code, notes, and snippets.

@thecodejunkie
Created February 17, 2011 07:53
Show Gist options
  • Save thecodejunkie/831257 to your computer and use it in GitHub Desktop.
Save thecodejunkie/831257 to your computer and use it in GitHub Desktop.
Workaround for Unitys limitation on IEnumerable<T> dependencies
/// <summary>
/// This class provides a workaround for Unitys lack of support for <see cref="IEnumerable{T}"/> dependencies. No additional
/// functionality should be added to this type.
/// </summary>
public sealed class UnityViewFactory : DefaultViewFactory
{
/// <summary>
/// The <see cref="Type"/> of the <see cref="UnityViewFactory"/> type.
/// </summary>
public static Type UnityViewFactoryType = typeof(UnityViewFactory);
/// <summary>
/// Initializes a new instance of the <see cref="UnityViewFactory"/> class.
/// </summary>
/// <param name="container">A <see cref="IUnityContainer"/> instance where dependencies can be resolved from.</param>
public UnityViewFactory(IUnityContainer container)
: base(container.Resolve<IViewLocator>(), container.ResolveAll<IViewEngineEx>())
{
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment