using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using MongoDB.Driver; namespace Sample.RabbitMQ.MongoDB { public class Startup { public Startup(IConfiguration configuration) { Configuration = configuration; } public IConfiguration Configuration { get; } public void ConfigureServices(IServiceCollection services) { services.AddSingleton(new MongoClient(Configuration.GetConnectionString("MongoDB"))); services.AddCap(x => { x.UseMongoDB(Configuration.GetConnectionString("MongoDB")); x.UseRabbitMQ("192.168.2.120"); x.UseDashboard(); }); services.AddControllers(); } public void Configure(IApplicationBuilder app) { app.UseRouting(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); } } }