Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

Startup.cs 2.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. using Luticate2.Auth.Controllers;
  2. using Luticate2.Utils.Controllers;
  3. using Microsoft.AspNetCore.Builder;
  4. using Microsoft.AspNetCore.Hosting;
  5. using Microsoft.EntityFrameworkCore;
  6. using Microsoft.Extensions.Configuration;
  7. using Microsoft.Extensions.DependencyInjection;
  8. using Microsoft.Extensions.Logging;
  9. using Test.Utils;
  10. using Test.Utils.DataAccess;
  11. using WebTest.Business;
  12. namespace WebTest
  13. {
  14. public class Startup
  15. {
  16. public Startup(IHostingEnvironment env)
  17. {
  18. var builder = new ConfigurationBuilder()
  19. .SetBasePath(env.ContentRootPath)
  20. .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
  21. .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);
  22. if (env.IsEnvironment("Development"))
  23. {
  24. // This will push telemetry data through Application Insights pipeline faster, allowing you to view results immediately.
  25. builder.AddApplicationInsightsSettings(developerMode: true);
  26. }
  27. builder.AddEnvironmentVariables();
  28. Configuration = builder.Build();
  29. }
  30. public IConfigurationRoot Configuration { get; }
  31. // This method gets called by the runtime. Use this method to add services to the container
  32. public void ConfigureServices(IServiceCollection services)
  33. {
  34. // Add framework services.
  35. services.AddApplicationInsightsTelemetry(Configuration);
  36. services.AddLuticateAuth(options => options.Version = "dev");
  37. services.AddTransient<PkGuidBusiness>();
  38. services.AddTransient<LuUtilsPkGuidDataAccess>();
  39. services.AddDbContext<LuUtilsDbContext>(options =>
  40. {
  41. options.UseNpgsql(Tests.ConnectionString);
  42. options.UseInternalServiceProvider(new ServiceCollection()
  43. .AddEntityFrameworkNpgsqlLuticate()
  44. .AddEntityFrameworkNpgsql()
  45. .BuildServiceProvider());
  46. });
  47. services.AddMvc()
  48. .AddLuticateAuth();
  49. }
  50. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline
  51. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
  52. {
  53. loggerFactory.AddConsole(Configuration.GetSection("Logging"));
  54. loggerFactory.AddDebug();
  55. app.UseApplicationInsightsRequestTelemetry();
  56. app.UseApplicationInsightsExceptionTelemetry();
  57. app.UseLuticateAuth();
  58. app.UseMvc();
  59. }
  60. }
  61. }