Skip to content

Instantly share code, notes, and snippets.

@kkozmic
Created May 9, 2010 09:15
Show Gist options
  • Save kkozmic/395045 to your computer and use it in GitHub Desktop.
Save kkozmic/395045 to your computer and use it in GitHub Desktop.
/// <summary>
/// Helper class used by <see cref="FromAssembly"/> to filter/order and instantiate <see cref="IWindsorInstaller"/> implementations
/// </summary>
public class InstallerFactory
{
/// <summary>
/// Performs custom filtering/ordering of given set of types.
/// </summary>
/// <param name="installerTypes">Set of concrete class types implementing <see cref="IWindsorInstaller"/> interface.</param>
/// <returns>Transformed <paramref name="installerTypes"/>.</returns>
/// <remarks>Default implementation simply returns types passed into it.</remarks>
public virtual IEnumerable<Type> Select(IEnumerable<Type> installerTypes)
{
return installerTypes;
}
/// <summary>
/// Performs custom instantiation of given <see cref="installerType"/>
/// </summary>
/// <remarks>
/// Default implementation uses public parameterless constructor to create the instance.
/// </remarks>
public virtual IWindsorInstaller CreateInstance(Type installerType)
{
return ReflectionUtil.CreateInstance<IWindsorInstaller>(installerType);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment