/// <summary> /// Do all of the cell actions /// </summary> /// <returns></returns> private static IEnumerable <ITranslation> GetTranslations() { if (_cellActions == null) { var specAidAssembly = Assembly.GetExecutingAssembly(); var specAidTypes = specAidAssembly.GetTypes() .Where(typeof(ITranslation).IsAssignableFrom) .Where(x => !x.IsAbstract).ToList(); var specAidTranlations = specAidTypes.Select(action => (ITranslation)Activator.CreateInstance(action)).OrderBy(t => t.ConsiderOrder); var testAssembly = AssemblyEntryFinderInUnitTests.Go(); var testTypes = testAssembly.GetTypes() .Where(typeof(ITranslation).IsAssignableFrom) .Where(x => !x.IsAbstract).ToList(); var testTranlations = testTypes.Select(action => (ITranslation)Activator.CreateInstance(action)).OrderBy(t => t.ConsiderOrder); _cellActions = testTranlations.Union(specAidTranlations); } return(_cellActions); }
/// <summary> /// Do all of the types that are of match action and given interface /// </summary> /// <typeparam name="T"></typeparam> /// <param name="type"></param> /// <param name="columnName"></param> /// <returns></returns> /// <remarks>May want to change this to be lazy loaded so i'm not creating this all of the time</remarks> private static IEnumerable <T> getActions <T>(Type type, string columnName) where T : IColumnAction { var specAidAssembly = Assembly.GetExecutingAssembly(); var specAidTypes = specAidAssembly.GetTypes() .Where(typeof(T).IsAssignableFrom) .Where(typeof(ColumnAction).IsAssignableFrom).ToList(); var specAidActions = specAidTypes.Select(action => (T)Activator.CreateInstance(action, type, columnName)).OrderBy( t => t.considerOrder); var testAssembly = AssemblyEntryFinderInUnitTests.Go(); var testTypes = testAssembly.GetTypes() .Where(typeof(T).IsAssignableFrom) .Where(typeof(ColumnAction).IsAssignableFrom).ToList(); var testActions = testTypes.Select(action => (T)Activator.CreateInstance(action, type, columnName)).OrderBy( t => t.considerOrder); return(testActions.Union(specAidActions)); }