Reorganized folder structure
This commit is contained in:
33
src/HopFrame.Web/ServiceCollectionExtensions.cs
Normal file
33
src/HopFrame.Web/ServiceCollectionExtensions.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using BlazorStrap;
|
||||
using CurrieTechnologies.Razor.SweetAlert2;
|
||||
using HopFrame.Database;
|
||||
using HopFrame.Security.Authentication;
|
||||
using HopFrame.Web.Services;
|
||||
using HopFrame.Web.Services.Implementation;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace HopFrame.Web;
|
||||
|
||||
public static class ServiceCollectionExtensions {
|
||||
public static IServiceCollection AddHopFrame<TDbContext>(this IServiceCollection services) where TDbContext : HopDbContextBase {
|
||||
services.AddHttpClient();
|
||||
services.AddScoped<IAuthService, AuthService<TDbContext>>();
|
||||
services.AddTransient<AuthMiddleware>();
|
||||
|
||||
// Component library's
|
||||
services.AddSweetAlert2();
|
||||
services.AddBlazorStrap();
|
||||
|
||||
services.AddHopFrameAuthentication<TDbContext>();
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
public static RazorComponentsEndpointConventionBuilder AddHopFrameAdminPages(this RazorComponentsEndpointConventionBuilder builder) {
|
||||
return builder
|
||||
.DisableAntiforgery()
|
||||
.AddAdditionalAssemblies(typeof(ServiceCollectionExtensions).Assembly)
|
||||
.AddInteractiveServerRenderMode();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user