public ActorProxyGeneratorBuildResult Build(
            Type proxyInterfaceType,
            IEnumerable <InterfaceDescription> interfaceDescriptions)
        {
            // create the context to build the proxy
            var context = new CodeBuilderContext(
                assemblyName: this.CodeBuilder.Names.GetProxyAssemblyName(proxyInterfaceType),
                assemblyNamespace: this.CodeBuilder.Names.GetProxyAssemblyNamespace(proxyInterfaceType),
                enableDebugging: CodeBuilderAttribute.IsDebuggingEnabled(proxyInterfaceType));
            var result = new ActorProxyGeneratorBuildResult(context);

            // ensure that method data types are built for each of the remote interfaces
            var methodBodyTypesResultsMap = interfaceDescriptions.ToDictionary(
                d => d,
                d => this.CodeBuilder.GetOrBuildMethodBodyTypes(d.InterfaceType));

            // build the proxy class that implements all of the interfaces explicitly
            result.ProxyType = this.BuildProxyType(context, proxyInterfaceType, methodBodyTypesResultsMap);

            // build the activator type to create instances of the proxy
            result.ProxyActivatorType = this.BuildProxyActivatorType(context, proxyInterfaceType, result.ProxyType);

            // build the proxy generator
            result.ProxyGenerator = this.CreateProxyGenerator(
                proxyInterfaceType,
                result.ProxyActivatorType);

            context.Complete();
            return(result);
        }
Beispiel #2
0
        protected bool TryGetProxyGenerator(Type interfaceType, out ActorProxyGeneratorBuildResult orBuildProxyGenerator)
        {
            if (this.proxyGeneratorBuildResultMap.TryGetValue(interfaceType, out var result))
            {
                {
                    orBuildProxyGenerator = result;
                    return(true);
                }
            }

            orBuildProxyGenerator = null;
            return(false);
        }
Beispiel #3
0
 protected void UpdateProxyGeneratorMap(Type interfaceType, ActorProxyGeneratorBuildResult result)
 {
     this.proxyGeneratorBuildResultMap.Add(interfaceType, result);
 }