選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 

49 行
1.4 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.AddScoped<IOrderService, OrderService>();
  15. services.AddTransient<ICmsService, CmsService>();
  16. services.AddCap(x =>
  17. {
  18. x.UseEntityFramework<AppDbContext>();
  19. x.UseRabbitMQ("localhost");
  20. x.UseDashboard();
  21. x.UseDiscovery(d =>
  22. {
  23. d.DiscoveryServerHostName = "localhost";
  24. d.DiscoveryServerPort = 8500;
  25. d.CurrentNodeHostName = "192.168.1.11";
  26. d.CurrentNodePort = 5800;
  27. d.NodeName = "CAP Node Windows";
  28. d.NodeId = 1;
  29. });
  30. });
  31. services.AddMvc();
  32. }
  33. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
  34. {
  35. loggerFactory.AddConsole();
  36. loggerFactory.AddDebug();
  37. app.UseMvc();
  38. app.UseCap();
  39. }
  40. }
  41. }