protected virtual void InitAppDataServices() { var types = ShReflectionUtils.GetTypesFromAssemblies <ShAppDataServiceBase>(AppDataServiceAssemblies) .ToList(); // special init for event hub var eventDataService = types.First(t => typeof(IAppEventService).IsAssignableFrom(t)); AppDataServices.Add(Activator.CreateInstance(eventDataService) as ShAppDataServiceBase); types.Remove(eventDataService); // the rest foreach (var type in types.OrderByDescending(a => a.Name)) { try { if (!AppDataServices.Any(t => t.GetType() == type)) { var instance = Activator.CreateInstance(type) as ShAppDataServiceBase; instance.Init(); AppDataServices.Add(instance); } } catch (Exception e) { // TODO throw; } } }
protected virtual void InitAppPlugins() { var types = ShReflectionUtils.GetTypesFromAssemblies <IPlugin>(AppPluginsAssemblies); foreach (var type in types.OrderByDescending(a => a.Name)) { try { if (!AppDataServices.Any(t => t.GetType() == type)) { var instance = Activator.CreateInstance(type) as IPlugin; instance.Init(); AppPlugins.Add(instance); } } catch (System.Exception e) { // TODO throw; } } }
protected virtual void CreateAppUIServices() { var types = ShReflectionUtils.GetTypesFromAssemblies <ShAppUIServiceBase>(AppUIServiceAssemblies); foreach (var type in types.OrderByDescending(a => a.Name)) { try { if (!AppDataServices.Any(t => t.GetType() == type)) { var instance = Activator.CreateInstance(type) as ShAppUIServiceBase; AppUIServices.Add(instance); } } catch (Exception e) { // TODO throw; } } }