public static void ConfigurarServicosFila(this IServiceCollection services) { var comandoFilas = new List <Type>(); comandoFilas.AddRange(BootstrapperMovimentacoes.RegistrarComandosFila()); services.AddSingleton <IQueueableService, QueueableService>(q => new QueueableService(comandoFilas)); }
public void ConfigureServices(IServiceCollection services) { services.AddControllers(); services.Configure <ApiBehaviorOptions>(options => { options.SuppressModelStateInvalidFilter = true; }); services.ConfigurarAutenticacao(); services.ConfigurarServicosFila(); services.AddAutoMapper(); services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>(); services.AddScoped <IMediatorHandler, MediatorHandler>(); services.AddScoped <IUsuario, AspNetUser>(); services.AddMediatR(typeof(Startup)); services.AddScoped <INotificationHandler <DomainNotification>, DomainNotificationHandler>(); services.AddScoped <IMongoSequenceRepository, MongoSequenceRepository>(); services.AddHostedService <QueueHostedService>(); AutoMapperConfiguration.RegisterMappings(); BootstrapperAgencia.RegistrarServicos(services); BootstrapperClientes.RegistrarServicos(services); BootstrapperMovimentacoes.RegistrarServicos(services); }