Ejemplo n.º 1
0
        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());
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Login([FromBody] LoginCommands command)
        {
            var response = await _mediator.Send(command).ConfigureAwait(false);

            return(Ok(response));
        }
Ejemplo n.º 3
0
 public MainVM()
 {
     User         = new User();
     LoginCommand = new LoginCommands(this);
 }