public static IMvcBuilder AddGrpcHttp(this IMvcBuilder mvcCoreBuilder, Action <GrpcHttpOptions> configure)
        {
            IServiceCollection compileServices = new ServiceCollection();

            compileServices.AddSingleton <IServiceCompiler, DefaultServiceCompiler>();
            compileServices.AddSingleton <IControllerDescriptorGenerator, DefaultControllerDescriptorGenerator>();
            GrpcHttpOptions options = new GrpcHttpOptions {
                CompileServices = compileServices
            };

            configure(options);
            IServiceProvider sp = compileServices.BuildServiceProvider();

            IControllerDescriptorGenerator csg = sp.GetRequiredService <IControllerDescriptorGenerator>();
            IServiceCompiler sc = sp.GetRequiredService <IServiceCompiler>();

            foreach (Type grpcServiceType in options.GrpcServices)
            {
                ControllerDescriptor controllerDescriptor = csg.Generate(grpcServiceType);
                foreach (IFilter filter in options.Filters)
                {
                    filter.Filter(controllerDescriptor);
                }
                mvcCoreBuilder = mvcCoreBuilder.AddApplicationPart(sc.Compile(controllerDescriptor));
            }

            mvcCoreBuilder.Services.AddSingleton <IServerCallContextFactory, DefaultServerCallContextFactory>();

            return(mvcCoreBuilder);
        }
 public CompilerCache(IServiceCompiler inner, IAssemblyCache assemblyCache)
 {
     _inner         = inner;
     _assemblyCache = assemblyCache;
 }