using Microsoft.Extensions.DependencyInjection; namespace Fengling.Platform.Infrastructure; public static class Extensions { public static IServiceCollection AddPlatformCore(this IServiceCollection services, Action? optionsAction = null, Action? serviceAction = null ) where TContext : PlatformDbContext { if (optionsAction != null) { var isRegistry = services.Any(x => x.ImplementationType == typeof(TContext)); if (!isRegistry) { services.AddDbContext(optionsAction); } } services.AddScoped>(); services.AddScoped(); serviceAction?.Invoke(services); return services; } }