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.

LuticateExtensions.cs 1.1KB

1234567891011121314151617181920212223242526272829303132333435
  1. using Luticate2.Auth.Business;
  2. using Luticate2.Auth.DataAccess;
  3. using Luticate2.Auth.Middlewares;
  4. using Microsoft.AspNetCore.Builder;
  5. using Microsoft.Extensions.DependencyInjection;
  6. namespace Luticate2.Auth.Controllers
  7. {
  8. public static class LuticateExtensions
  9. {
  10. public static IServiceCollection AddLuticate(this IServiceCollection services)
  11. {
  12. services.AddSingleton<LuGroupsController>();
  13. services.AddSingleton<LuGroupsBusiness>();
  14. services.AddSingleton<LuGroupsDataAccess>();
  15. services.AddDbContext<LuDatabaseContext>();
  16. return services;
  17. }
  18. public static IMvcBuilder AddLuticate(this IMvcBuilder builder)
  19. {
  20. // builder.AddApplicationPart(typeof(LuController).GetTypeInfo().Assembly)
  21. // .AddControllersAsServices();
  22. return builder;
  23. }
  24. public static IApplicationBuilder UseLuticate(this IApplicationBuilder app)
  25. {
  26. app.UseMiddleware<LuAuthMiddleware>();
  27. return app;
  28. }
  29. }
  30. }