Advertisement
Guest User

Untitled

a guest
Jan 28th, 2020
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. public void ConfigureContainer(ServiceRegistry services)
  2. {
  3. services.AddOptions();
  4. services.Configure<KafkaOptions>(Configuration.GetSection("Kafka"));
  5.  
  6.  
  7. services.AddControllers();
  8.  
  9. services.AddMvc()
  10. .AddJsonOptions(options => { options.JsonSerializerOptions.IgnoreNullValues = true; });
  11. services.AddLogging();
  12.  
  13. services.AddRouting(option => { option.LowercaseUrls = true; });
  14.  
  15. services.For<IMediator>().Use<Mediator>().Transient();
  16. services.For<ServiceFactory>().Use(ctx => ctx.GetInstance);
  17. services.AddCors(options => { options.AddDefaultPolicy(builder => { builder.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader(); }); });
  18.  
  19. //Kafka
  20. services.For(typeof(IKafkaPublisher<>)).Add(typeof(KafkaPublisher<>)).Scoped();
  21. services.AddHostedService<BaseLineListener>();
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement