Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 

39 rindas
1.1 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("192.168.2.120");
  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. }