private void ConfigureCommands() { services.AddSingleton <ICommandFactory, CommandFactory>(); services.AddSingleton <ICommandEventsManager, CommandEventsManager>(); services.AddSingleton <ICommandParser, CommandParser>(); services.AddSingleton <Func <string, ICommand> >((IServiceProvider serviceProvider) => name => { var commandType = CommandTypeResolver.Resolve(name); if (commandType == null) { return(null); } return((ICommand)serviceProvider.GetService(commandType)); }); foreach (var commandType in CommandTypeResolver.GetCommandTypes()) { services.AddTransient(commandType); } }
private ResolvedCommand ResolveCommandType(string text) { return(CommandTypeResolver.Resolve(text)); }