using HopFrame.Api.Controller;
using HopFrame.Api.Logic;
using HopFrame.Api.Logic.Implementation;
using HopFrame.Database;
using HopFrame.Security.Authentication;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
namespace HopFrame.Api.Extensions;
public static class ServiceCollectionExtensions {
///
/// Adds all HopFrame endpoints and services to the application
///
/// The service provider to add the services to
/// The data source for all HopFrame entities
public static void AddHopFrame(this IServiceCollection services) where TDbContext : HopDbContextBase {
services.AddMvcCore().UseSpecificControllers(typeof(SecurityController));
AddHopFrameNoEndpoints(services);
}
///
/// Adds all HopFrame services to the application
///
/// The service provider to add the services to
/// The data source for all HopFrame entities
public static void AddHopFrameNoEndpoints(this IServiceCollection services) where TDbContext : HopDbContextBase {
services.TryAddSingleton();
services.AddScoped>();
services.AddHopFrameAuthentication();
}
}