Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

LuticateExtensions.cs 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using Luticate2.Auth.Business;
  2. using Luticate2.Auth.DataAccess;
  3. using Luticate2.Auth.Middlewares;
  4. using Luticate2.Utils.Dbo.OrderBy;
  5. using Microsoft.AspNetCore.Builder;
  6. using Microsoft.AspNetCore.Mvc;
  7. using Microsoft.Extensions.DependencyInjection;
  8. namespace Luticate2.Auth.Controllers
  9. {
  10. public static class LuticateExtensions
  11. {
  12. public static IServiceCollection AddLuticate(this IServiceCollection services)
  13. {
  14. services.AddSingleton<LuGroupsController>();
  15. services.AddSingleton<LuGroupsBusiness>();
  16. services.AddSingleton<LuGroupsDataAccess>();
  17. services.AddSingleton<LuUsersController>();
  18. services.AddDbContext<LuDatabaseContext>();
  19. return services;
  20. }
  21. public static IMvcBuilder AddLuticate(this IMvcBuilder builder)
  22. {
  23. // builder.AddApplicationPart(typeof(LuController).GetTypeInfo().Assembly)
  24. // .AddControllersAsServices();
  25. builder.Services.Configure<MvcOptions>(
  26. options => options.ModelBinderProviders.Insert(0, new LuOrderByBinderProvider()));
  27. return builder;
  28. }
  29. public static IApplicationBuilder UseLuticate(this IApplicationBuilder app)
  30. {
  31. app.UseMiddleware<LuAuthMiddleware>();
  32. return app;
  33. }
  34. }
  35. }