public static void InitializeAddOnTypes() { List <Type> types = new List <Type>(); foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) { Type[] exportedTypes = new Type[0]; try { exportedTypes = assembly.GetExportedTypes(); } catch { } finally { types.AddRange(exportedTypes); } } AddOnTypes.Clear(); AddOnTypes.AddRange(types .Where(t => t.GetCustomAttribute <AddOnAttribute>() != null && t.IsClass && !t.IsAbstract) .Where(t => t.GetInterface(typeof(IAddOn).FullName) != null)); ProjectTypes.Clear(); ProjectTypes.AddRange(types .Where(t => t.GetCustomAttribute <ProjectTypeAttribute>() != null && t.IsClass && !t.IsAbstract)); }
/// <summary> /// Initializes a new instance of the <see cref="AddOnWrapperBuilder{TModel}"/> class. /// </summary> /// <param name="helper">The helper.</param> /// <param name="addOnType">Type of the add on.</param> public AddOnWrapperBuilder(HtmlHelper <TModel> helper, AddOnTypes addOnType) : base(helper) { this.addOnType = addOnType; }