static void AddFeignClients(FeignClientTypeBuilder feignClientTypeBuilder, IServiceCollection services, Assembly assembly, ServiceLifetime lifetime) { if (assembly == null) { return; } foreach (var serviceType in assembly.GetTypes().Where(FeignClientTypeBuilder.NeedBuildType)) { Type proxyType = feignClientTypeBuilder.BuildType(serviceType); switch (lifetime) { case ServiceLifetime.Singleton: services.TryAddSingleton(serviceType, proxyType); break; case ServiceLifetime.Scoped: services.TryAddScoped(serviceType, proxyType); break; case ServiceLifetime.Transient: services.TryAddTransient(serviceType, proxyType); break; default: break; } } }
public void TestMethod1() { DynamicAssembly dynamicAssembly = new DynamicAssembly(); dynamicAssembly.DEBUG_MODE = true; FeignClientTypeBuilder feignClientTypeBuilder = new FeignClientTypeBuilder(dynamicAssembly); feignClientTypeBuilder.BuildType(typeof(ITestService));; feignClientTypeBuilder.Save(); }
public CastleWindsorFeignBuilder() { TypeBuilder = new FeignClientTypeBuilder(); }
public DependencyInjectionFeignBuilder() { TypeBuilder = new FeignClientTypeBuilder(); }
public AutofacFeignBuilder() { TypeBuilder = new FeignClientTypeBuilder(); }