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.
 
 
 

48 lines
1.3 KiB

  1. using Microsoft.AspNetCore.Builder;
  2. using Microsoft.Extensions.Configuration;
  3. using Microsoft.Extensions.DependencyInjection;
  4. using Microsoft.OpenApi.Models;
  5. namespace Samples.Redis.SqlServer
  6. {
  7. public class Startup
  8. {
  9. public Startup(IConfiguration configuration)
  10. {
  11. Configuration = configuration;
  12. }
  13. public IConfiguration Configuration { get; }
  14. public void ConfigureServices(IServiceCollection services)
  15. {
  16. services.AddControllers();
  17. services.AddSwaggerGen(c =>
  18. {
  19. c.SwaggerDoc("v1", new OpenApiInfo { Title = "Samples.Redis.SqlServer", Version = "v1" });
  20. });
  21. services.AddCap(options =>
  22. {
  23. options.UseRedis("redis-node-0:6379,password=cap");
  24. options.UseSqlServer("Server=db;Database=master;User=sa;Password=P@ssw0rd;");
  25. });
  26. }
  27. public void Configure(IApplicationBuilder app)
  28. {
  29. app.UseSwagger();
  30. app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "Samples.Redis.SqlServer v1"));
  31. app.UseRouting();
  32. app.UseEndpoints(endpoints =>
  33. {
  34. endpoints.MapControllers();
  35. });
  36. }
  37. }
  38. }