using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace JSMachine.WMS.Infrastructure { public static class GlobalServericeProvidor { public static IServiceProvider IServiceProvider { get; private set; } public static void UseGlobalServiceProvider(this IApplicationBuilder builder) { IServiceProvider = builder.ApplicationServices; } public static T GetService() { return IServiceProvider.GetService(); } } }