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.
 
 
 

46 lines
1.3 KiB

  1. using Microsoft.AspNetCore.Builder;
  2. using Microsoft.AspNetCore.Hosting;
  3. using Microsoft.Extensions.DependencyInjection;
  4. using Microsoft.Extensions.Logging;
  5. using Sample.RabbitMQ.SqlServer.Services;
  6. using Sample.RabbitMQ.SqlServer.Services.Impl;
  7. namespace Sample.RabbitMQ.SqlServer
  8. {
  9. public class Startup
  10. {
  11. public void ConfigureServices(IServiceCollection services)
  12. {
  13. services.AddDbContext<AppDbContext>();
  14. services.AddTransient<IOrderService, OrderService>();
  15. services.AddTransient<ICmsService, CmsService>();
  16. services.AddCap(x =>
  17. {
  18. x.UseEntityFramework<AppDbContext>();
  19. x.UseRabbitMQ(xx =>
  20. {
  21. xx.HostName = "192.168.2.206";
  22. xx.UserName = "admin";
  23. xx.Password = "123123";
  24. });
  25. x.UseDashboard();
  26. });
  27. services.AddMvc();
  28. }
  29. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
  30. {
  31. loggerFactory.AddConsole();
  32. loggerFactory.AddDebug();
  33. app.UseMvc();
  34. app.UseCap();
  35. app.UseCapDashboard();
  36. }
  37. }
  38. }