DispatcherRegistry BuildDispatcherRegistry(IEnumerable <Assembly> assemblies)
        {
            var dispatchActors = assemblies.SelectMany(x => x.GetTypes())
                                 .Where(x => typeof(DispatchActorGrain).IsAssignableFrom(x) && !x.IsAbstract);

            var dispatcherRegistry       = new DispatcherRegistry();
            var handlerNamingConventions = conventions.Count > 0 ? conventions.ToArray() : null;

            foreach (var actor in dispatchActors)
            {
                dispatcherRegistry.Register(actor, new Dispatcher(actor, handlerNamingConventions));
            }

            return(dispatcherRegistry);
        }
Exemple #2
0
        static DispatcherRegistry BuildDispatcherRegistry(IServiceProvider services, IEnumerable <Assembly> assemblies)
        {
            var dispatchActors = assemblies.SelectMany(x => x.GetTypes())
                                 .Where(x => typeof(DispatchActorGrain).IsAssignableFrom(x) && !x.IsAbstract);

            var dispatcherRegistry = new DispatcherRegistry();
            var options            = services.GetService <IOptions <DispatcherOptions> >().Value;

            foreach (var actor in dispatchActors)
            {
                dispatcherRegistry.Register(actor, new Dispatcher(actor, options.HandlerNamingConventions, options.RootTypes));
            }

            return(dispatcherRegistry);
        }