public void OnLoadData() { LogUtils.DoLog($"LOADING DATA {GetType()}"); instance.Instances = new Dictionary <Type, IDataExtension>(); List <Type> instancesExt = ReflectionUtils.GetInterfaceImplementations(typeof(IDataExtension), GetType()); var instancesLegacies = ReflectionUtils.GetSubtypesRecursive(typeof(DataExtensionLegacyBase <>), GetType()).ToDictionary(x => x.BaseType.GetGenericArguments()[0], x => x); LogUtils.DoLog($"SUBTYPE COUNT: {instancesExt.Count}; LEGACY COUNT: {instancesLegacies.Count}"); foreach (Type type in instancesExt) { LogUtils.DoLog($"LOADING DATA TYPE {type}"); if (type.IsGenericType) { try { var targetParameters = type.Assembly.GetTypes().Where(x => !x.IsAbstract && !x.IsInterface && !x.IsGenericType && ReflectionUtils.CanMakeGenericTypeVia(type.GetGenericArguments()[0], x)).ToArray(); LogUtils.DoLog($"PARAMETER PARAMS FOR {type.GetGenericArguments()[0]} FOUND: [{string.Join(",", targetParameters.Select(x => x.ToString()).ToArray())}]"); foreach (var param in targetParameters) { var targetType = type.MakeGenericType(param); ProcessExtension(instancesLegacies, targetType); } } catch (Exception e) { LogUtils.DoErrorLog($"FAILED CREATING GENERIC PARAM EXTENSOR: {e}"); } } else { ProcessExtension(instancesLegacies, type); } } ThreadHelper.dispatcher.Dispatch(() => { OnDataLoaded?.Invoke(); OnDataLoaded = null; }); }