public GenericHandler(ICodecContainer codecContainer, IRawHandlerFactory delegateFactory, IReadOnlyList <ServiceDescription> serviceDescriptionChain, MethodDescription methodDescription, ServicePath servicePath) { rawHandlers = new ConcurrentDictionary <TypesKey, IHandler>(); createRawHandler = delegateFactory.CreateGenericClass(serviceDescriptionChain, methodDescription, servicePath); genericParameterCount = methodDescription.GenericParameters.Count; typeCodec = codecContainer.GetManualCodecFor <Type>(); }
public GenericHandler(ICodecContainer codecContainer, IRawHandlerFactory delegateFactory, IReadOnlyList<ServiceDescription> serviceDescriptionChain, MethodDescription methodDescription, ServicePath servicePath) { rawHandlers = new ConcurrentDictionary<TypesKey, IHandler>(); createRawHandler = delegateFactory.CreateGenericClass(serviceDescriptionChain, methodDescription, servicePath); genericParameterCount = methodDescription.GenericParameters.Count; typeCodec = codecContainer.GetManualCodecFor<Type>(); }
public IHandler CreateHandler(ServiceDescription rootDescription, ServicePath path) { var serviceDescriptionChain = CreateServiceDescriptionChain(rootDescription, path); var methodDescription = GetMethodDescription(serviceDescriptionChain, path); return(methodDescription.GenericParameters.Any() ? new GenericHandler(codecContainer, rawHandlerFactory, serviceDescriptionChain, methodDescription, path) : rawHandlerFactory.CreateGenericClass(serviceDescriptionChain, methodDescription, path)(null)); }
private Func <Type[], IHandler> CreateClass(params string[] path) { var serviceDescriptionChain = new List <ServiceDescription> { globalServiceDescription }; for (int i = 1; i < path.Length - 1; i++) { serviceDescriptionChain.Add(serviceDescriptionChain.Last().Subservices.Single(x => x.Name == path[i])); } var methodDescription = serviceDescriptionChain.Last().Methods.Single(x => x.Name == path.Last()); var servicePath = new ServicePath(path); return(factory.CreateGenericClass(serviceDescriptionChain, methodDescription, servicePath)); }