public ClusterConfig AddRootActors(ClusterConfig clusterConfig) { List <Type> actorTypes = typeof(SetupRootActors).Assembly.GetTypes().Where(t => { if (t.IsInterface) { return(false); } var typeInfo = t.GetTypeInfo(); var otherTypeInfo = typeof(IActor).GetTypeInfo(); return(otherTypeInfo.IsAssignableFrom(typeInfo)); }).ToList(); foreach (Type actorType in actorTypes) { var typeInfo = actorType.GetTypeInfo(); ActorAttribute?actorAttribute = typeInfo.GetCustomAttribute <ActorAttribute>(); if (actorAttribute != null && !string.IsNullOrWhiteSpace(actorAttribute.Kind)) { var kind = actorAttribute.Kind; var props = Props.FromProducer(() => (IActor)this._serviceProvider.GetRequiredService(actorType)); clusterConfig = clusterConfig.WithClusterKind(kind, props); this.logger.LogInformation("'{Type}' is set up FromProducer with Kind '{Kind}'", actorType.Name, kind); } else { this.logger.LogWarning("'{Type}' must have ActorAttribute with a Kind value to be activated. Will be ignored.", actorType.Name); } } return(clusterConfig); }