You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

39 lines
1.0 KiB

  1. using Microsoft.AspNetCore.Builder;
  2. using Microsoft.Extensions.Configuration;
  3. using Microsoft.Extensions.DependencyInjection;
  4. using MongoDB.Driver;
  5. namespace Sample.RabbitMQ.MongoDB
  6. {
  7. public class Startup
  8. {
  9. public Startup(IConfiguration configuration)
  10. {
  11. Configuration = configuration;
  12. }
  13. public IConfiguration Configuration { get; }
  14. public void ConfigureServices(IServiceCollection services)
  15. {
  16. services.AddSingleton<IMongoClient>(new MongoClient(Configuration.GetConnectionString("MongoDB")));
  17. services.AddCap(x =>
  18. {
  19. x.UseMongoDB(Configuration.GetConnectionString("MongoDB"));
  20. x.UseRabbitMQ("");
  21. x.UseDashboard();
  22. });
  23. services.AddControllers();
  24. }
  25. public void Configure(IApplicationBuilder app)
  26. {
  27. app.UseRouting();
  28. app.UseEndpoints(endpoints =>
  29. {
  30. endpoints.MapControllers();
  31. });
  32. }
  33. }
  34. }