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.

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System;
  2. using Microsoft.AspNetCore.Builder;
  3. using Microsoft.AspNetCore.Hosting;
  4. using Microsoft.AspNetCore.Mvc;
  5. using Microsoft.Extensions.Configuration;
  6. using Microsoft.Extensions.DependencyInjection;
  7. using MongoDB.Driver;
  8. namespace Sample.RabbitMQ.MongoDB
  9. {
  10. public class Startup
  11. {
  12. public Startup(IConfiguration configuration)
  13. {
  14. Configuration = configuration;
  15. }
  16. public IConfiguration Configuration { get; }
  17. public void ConfigureServices(IServiceCollection services)
  18. {
  19. services.AddSingleton<IMongoClient>(new MongoClient(Configuration.GetConnectionString("MongoDB")));
  20. services.AddCap(x =>
  21. {
  22. x.UseMongoDB(Configuration.GetConnectionString("MongoDB"));
  23. x.UseRabbitMQ("192.168.2.120");
  24. x.UseDashboard();
  25. });
  26. services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
  27. }
  28. public void Configure(IApplicationBuilder app, IHostingEnvironment env)
  29. {
  30. if (env.IsDevelopment())
  31. {
  32. app.UseDeveloperExceptionPage();
  33. }
  34. app.UseMvc();
  35. }
  36. }
  37. }