您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

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. }