예제 #1
0
        public static void AddCommandRouter(this IServiceCollection services, Assembly entryAssembly, Action <CommandRouterOptions> optionsFunc)
        {
            var options = new CommandRouterOptions();

            optionsFunc(options);

            AddCommandRouter(services, entryAssembly, options);
        }
예제 #2
0
        private static void AddCommandRouter(this IServiceCollection services, Assembly entryAssembly, CommandRouterOptions options)
        {
            var manager = GetApplicationManager(services, entryAssembly);

            services.AddSingleton(manager);

            RegisterCommands(services, manager);

            services.AddSingleton <ICommandTable, CommandTable>();

            services.AddSingleton <ICommandActivator, DefaultCommandActivator>();

            services.AddSingleton <ICommandRunner, CommandRunner>();

            services.AddSingleton <ICommandSelector, DefaultCommandSelector>();

            var paramBinder = new ParameterBinder(options.PropertyConverters);

            services.AddSingleton(paramBinder);
        }