您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

38 行
1.0 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("localhost");
  20. });
  21. services.AddMvc();
  22. }
  23. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
  24. {
  25. loggerFactory.AddConsole();
  26. loggerFactory.AddDebug();
  27. app.UseMvc();
  28. app.UseCap();
  29. }
  30. }
  31. }