Exemplo n.º 1
0
        public ServiceProxyResponder(BamConf conf, ILogger logger)
            : base(conf, logger)
        {
            _commonServiceProvider   = new Incubator();
            _appServiceProviders     = new Dictionary <string, Incubator>();
            _appSecureChannels       = new Dictionary <string, SecureChannel>();
            _commonSecureChannel     = new SecureChannel();
            _clientProxyGenerators   = new Dictionary <string, IClientProxyGenerator>();
            RendererFactory          = new RendererFactory(logger);
            ExecutionRequestResolver = new ExecutionRequestResolver();

            AddCommonService(_commonSecureChannel);
            AddClientProxyGenerator(new CsClientProxyGenerator(), "proxies.cs", "csproxies", "csharpproxies");
            AddClientProxyGenerator(new JsClientProxyGenerator(), "proxies.js", "jsproxies", "javascriptproxies");

            CommonServiceAdded += (type, obj) =>
            {
                CommonSecureChannel.ServiceProvider.Set(type, obj);
            };
            CommonServiceRemoved += (type) =>
            {
                CommonSecureChannel.ServiceProvider.Remove(type);
            };
            AppServiceAdded += (appName, type, instance) =>
            {
                if (!AppSecureChannels.ContainsKey(appName))
                {
                    SecureChannel channel = new SecureChannel();
                    channel.ServiceProvider.CopyFrom(CommonServiceProvider, true);
                    AppSecureChannels.Add(appName, channel);
                }

                AppSecureChannels[appName].ServiceProvider.Set(type, instance, false);
            };
        }
Exemplo n.º 2
0
        public virtual ExecutionRequest ResolveExecutionRequest(IHttpContext httpContext, string appName)
        {
            GetServiceProxies(appName, out Incubator proxiedClasses, out List <ProxyAlias> aliases);

            return(ExecutionRequestResolver.ResolveExecutionRequest(httpContext, proxiedClasses, aliases.ToArray()));
        }