Beispiel #1
0
        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;
                }
            }
        }
Beispiel #2
0
        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();
 }
Beispiel #4
0
 public DependencyInjectionFeignBuilder()
 {
     TypeBuilder = new FeignClientTypeBuilder();
 }
Beispiel #5
0
 public AutofacFeignBuilder()
 {
     TypeBuilder = new FeignClientTypeBuilder();
 }