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

12345678910111213141516171819202122232425262728293031323334353637
  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.AddSingleton<LuUsersController>();
  16. services.AddDbContext<LuDatabaseContext>();
  17. return services;
  18. }
  19. public static IMvcBuilder AddLuticate(this IMvcBuilder builder)
  20. {
  21. // builder.AddApplicationPart(typeof(LuController).GetTypeInfo().Assembly)
  22. // .AddControllersAsServices();
  23. return builder;
  24. }
  25. public static IApplicationBuilder UseLuticate(this IApplicationBuilder app)
  26. {
  27. app.UseMiddleware<LuAuthMiddleware>();
  28. return app;
  29. }
  30. }
  31. }