public void RegisterServices(IServiceCollection services) { DataServiceRegistration.Register(services); services .AddSingleton(InputParserOptions.Default) .AddSingleton <Action <IServiceProvider, IModuleFactory> >((serviceProvider, moduleFactory) => { var serviceCollector = TypeCollector.Create(type => type.IsInterface && type != typeof(IModule)); var services = serviceCollector.Collect <IModule>(definitions => definitions.DescribeAssembly <IModuleFactory>()); foreach (var service in services) { moduleFactory.Add(service.Name, (IModule)serviceProvider.GetRequiredService(service)); } }) .AddSingleton(UtilityCommands.GetCommands() .Union(ManagementCommands.GetCommands()) .Union(LoginCommands.GetCommands())) .AddSingleton <IApplicationSettings, ApplicationSettings>() .AddSingleton(typeof(IConsoleWrapper <>), typeof(ConsoleWrapper <>)) .RegisterCacheState <DateTimeOffset>() .RegisterServices(BuildSecurityProfiles, configureDistrubutedCacheOptions: ConfigureDistrubutedCacheOptions, configureDistributedCacheEntryOptions: ConfigureDistributedCacheEntryOptions, scannerConfiguration: scanner => scanner .FromAssemblyOf <ServiceRegistration>() .AddClasses(filter => filter.WithoutAttribute <IgnoreScanningAttribute>()) .AsMatchingInterface()); }
public async Task <IActionResult> Login([FromBody] LoginCommands command) { var response = await _mediator.Send(command).ConfigureAwait(false); return(Ok(response)); }
public MainVM() { User = new User(); LoginCommand = new LoginCommands(this); }