/// <summary> /// Reads an input file using the given <paramref name="filename"/> /// and converts it into a set of <see cref="Action{TTarget}"/> /// instances that can be applied to a target class instance.. /// </summary> /// <remarks>This class can only load valid .NET Assemblies.</remarks> /// <param name="filename">The target file to be loaded.</param> /// <returns>A set of <see cref="Action{IServiceContainer}"/> instances to apply to a target type.</returns> public virtual IEnumerable <Action <TTarget> > Load(string filename) { Assembly assembly = null; if (AssemblyLoader == null) { throw new ArgumentException("The assembly loader cannot be null"); } // Load the assembly into memory assembly = AssemblyLoader.Load(filename); var results = new List <Action <TTarget> >(); var listActions = AssemblyActionLoader.Load(assembly); foreach (var action in listActions) { action(results); } return(results); }
/// <summary> /// Initializes the class with the default property values. /// </summary> public AssemblyTargetLoader() { AssemblyLoader = new AssemblyLoader(); AssemblyActionLoader = new AssemblyActionLoader <TTarget>(() => TypeLoaders); }