public CollectionCodec(Type type, Type elementType, ICodecContainer codecContainer) : base(type, elementType, codecContainer) { collectionConstructor = type.GetConstructor(Type.EmptyTypes); getCountMethod = typeof(ICollection<>).MakeGenericType(elementType).GetMethod("get_Count"); addMethod = typeof(ICollection<>).MakeGenericType(elementType).GetMethod("Add"); }
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 ICodecContainer GetCodecContainer() { return codecContainer ?? (codecContainer = overrides.CodecContainer != null ? overrides.CodecContainer(this) : new CodecContainer()); }
public void Setup() { serviceDescriptionBuilder = new ServiceDescriptionBuilder(new MethodDescriptionBuilder()); codecContainer = new CodecContainer(); methodCallProcessor = Substitute.For <IOutgoingMethodCallProcessor>(); factory = new ServiceProxyClassFactory(serviceDescriptionBuilder, codecContainer); }
public CollectionCodec(Type type, Type elementType, ICodecContainer codecContainer) : base(type, elementType, codecContainer) { collectionConstructor = type.GetConstructor(Type.EmptyTypes); getCountMethod = typeof(ICollection <>).MakeGenericType(elementType).GetMethod("get_Count"); addMethod = typeof(ICollection <>).MakeGenericType(elementType).GetMethod("Add"); }
public RawHandlerFactory(ICodecContainer codecContainer) { this.codecContainer = codecContainer; var appDomain = AppDomain.CurrentDomain; var assemblyBuilder = appDomain.DefineDynamicAssembly(new AssemblyName("SharpRpcHandlers"), AssemblyBuilderAccess.Run); moduleBuilder = assemblyBuilder.DefineDynamicModule("SharpRpcHandlerModule"); }
public ICodecContainer GetCodecContainer() { return(codecContainer ?? (codecContainer = overrides.CodecContainer != null ? overrides.CodecContainer(this) : new CodecContainer())); }
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 void Setup() { serviceDescriptionBuilder = new ServiceDescriptionBuilder(new MethodDescriptionBuilder()); codecContainer = new CodecContainer(); requestProcessor = Substitute.For <IOutgoingRequestProcessor>(); factory = new ProxyFactory(serviceDescriptionBuilder, codecContainer); }
public NewExpressionSubcodec(ExpressionCodec commonCodec, ICodecContainer codecContainer) : base(commonCodec, codecContainer) { constructorInfoCodec = codecContainer.GetManualCodecFor <ConstructorInfo>(); expressionArrayCodec = codecContainer.GetManualCodecFor <Expression[]>(); memberInfoArrayCodec = codecContainer.GetManualCodecFor <MemberInfo[]>(); }
public IncomingRequestProcessor(ILogger logger, IServiceImplementationContainer serviceImplementationContainer, IHandlerContainer handlerContainer, ICodecContainer codecContainer) { this.logger = logger; this.serviceImplementationContainer = serviceImplementationContainer; this.handlerContainer = handlerContainer; exceptionCodec = codecContainer.GetManualCodecFor <Exception>(); }
public ManualCodec(ICodecContainer codecContainer, IEmittingCodec emittingCodec) : base(typeof(T), emittingCodec) { this.codecContainer = codecContainer; calculateSizeDelegate = (CalculateSizeDelegate)CalculateSizeMethod.CreateDelegate(typeof(CalculateSizeDelegate)); encodeDelegate = (EncodeDelegate)EncodeMethod.CreateDelegate(typeof(EncodeDelegate)); decodeDelegate = (DecodeDelegate)DecodeMethod.CreateDelegate(typeof(DecodeDelegate)); decodeFastDelegate = (DecodeDelegate)DecodeFastMethod.CreateDelegate(typeof(DecodeDelegate)); }
public IncomingRequestProcessor(ILogger logger, IServiceImplementationContainer serviceImplementationContainer, IHandlerContainer handlerContainer, ICodecContainer codecContainer) { this.logger = logger; this.serviceImplementationContainer = serviceImplementationContainer; this.handlerContainer = handlerContainer; exceptionCodec = codecContainer.GetManualCodecFor<Exception>(); }
public MemberInfoCodec(ICodecContainer codecContainer) { memberTypesCodec = codecContainer.GetManualCodecFor <MemberTypes>(); constructorInfoCodec = codecContainer.GetManualCodecFor <ConstructorInfo>(); eventInfoCodec = codecContainer.GetManualCodecFor <EventInfo>(); fieldInfoCodec = codecContainer.GetManualCodecFor <FieldInfo>(); methodInfoCodec = codecContainer.GetManualCodecFor <MethodInfo>(); propertyInfoCodec = codecContainer.GetManualCodecFor <PropertyInfo>(); }
public ProxyFactory(IServiceDescriptionBuilder serviceDescriptionBuilder, ICodecContainer codecContainer) { this.serviceDescriptionBuilder = serviceDescriptionBuilder; this.codecContainer = codecContainer; var appDomain = AppDomain.CurrentDomain; var assemblyBuilder = appDomain.DefineDynamicAssembly(new AssemblyName("SharpRpcServiceProxies"), AssemblyBuilderAccess.Run); moduleBuilder = assemblyBuilder.DefineDynamicModule("SharpRpcServiceProxyModule"); }
public IncomingRequestProcessor(IRpcClientServer clientServer, IServiceImplementationContainer serviceImplementationContainer, IServiceMethodHandlerContainer serviceMethodHandlerContainer, ICodecContainer codecContainer) { this.clientServer = clientServer; this.logger = clientServer.Logger; this.serviceImplementationContainer = serviceImplementationContainer; this.serviceMethodHandlerContainer = serviceMethodHandlerContainer; exceptionCodec = codecContainer.GetManualCodecFor<Exception>(); }
public void Setup() { var serviceDescriptionBuilder = new ServiceDescriptionBuilder(new MethodDescriptionBuilder()); codecContainer = new CodecContainer(); factory = new RawHandlerFactory(codecContainer); service = Substitute.For <IGlobalService>(); globalServiceDescription = serviceDescriptionBuilder.Build(typeof(IGlobalService)); }
public CollectionCodec(Type type, Type elementType, ICodecContainer codecContainer) : base(type, elementType, codecContainer) { collectionConstructor = type.GetConstructor(Type.EmptyTypes); getCountMethod = typeof(ICollection <>).MakeGenericType(elementType).GetMethod("get_Count"); addMethod = typeof(ICollection <>).MakeGenericType(elementType).GetMethod("Add"); getEnumeratorMethod = typeof(IEnumerable <>).MakeGenericType(elementType).GetMethod("GetEnumerator"); moveNextMethod = typeof(IEnumerator).GetMethod("MoveNext"); getCurrentMethod = typeof(IEnumerator <>).MakeGenericType(elementType).GetMethod("get_Current"); }
public void Setup() { codecContainer = new CodecContainer(); factory = new ServiceMethodHandlerFactory(codecContainer); service = Substitute.For <IGlobalService>(); var serviceDescriptionBuilder = new ServiceDescriptionBuilder(new MethodDescriptionBuilder()); var globalServiceDescription = serviceDescriptionBuilder.Build(typeof(IGlobalService)); globalServiceImplementationInfo = new ServiceImplementationInfo(globalServiceDescription, service); }
public DirectDataContractCodec(Type type, ICodecContainer codecContainer, bool doNotCalculateMaxSize = false) { this.type = type; memberInfos = type.EnumerateDataMembers() .Select(x => new DataMemberInfo { Codec = codecContainer.GetEmittingCodecFor(x.PropertyType), Property = x }) .OrderBy(x => x.Codec.FixedSize.HasValue ? 0 : x.Codec.MaxSize.HasValue ? 1 : 2) .ThenBy(x => x.Property.Name) .ToArray(); numFixedProperties = memberInfos.IndexOfFirst(x => !x.Codec.FixedSize.HasValue, memberInfos.Length); fixedPartOfSize = sizeof(int) + memberInfos.Take(numFixedProperties).Sum(x => x.Codec.FixedSize.Value); maxSize = doNotCalculateMaxSize ? null : memberInfos.All(x => x.Codec.MaxSize.HasValue) ? memberInfos.Sum(x => x.Codec.MaxSize) : null; }
public StructuralCodecBase(Type type, ICodecContainer codecContainer, bool doNotCalculateMaxSize = false) { this.type = type; memberInfos = EnumerateMembers(type) .Select(x => new DataMemberInfo { Codec = codecContainer.GetEmittingCodecFor(GetMemberType(x)), Member = x }) .OrderBy(x => x.Codec.FixedSize.HasValue ? 0 : x.Codec.MaxSize.HasValue ? 1 : 2) .ThenBy(x => x.Member.Name) .ToArray(); numFixedProperties = memberInfos.IndexOfFirst(x => !x.Codec.FixedSize.HasValue, memberInfos.Length); fixedPartOfSize = memberInfos.Take(numFixedProperties).Sum(x => x.Codec.FixedSize.Value); if (CanBeNull) { fixedPartOfSize += sizeof(int); } maxSize = doNotCalculateMaxSize ? null : memberInfos.All(x => x.Codec.MaxSize.HasValue) ? memberInfos.Sum(x => x.Codec.MaxSize) : null; }
public ExpressionCodec(ICodecContainer codecContainer) { expressionTypeCodec = codecContainer.GetManualCodecFor <ExpressionType>(); binarySubcodec = new BinaryExpressionSubcodec(this, codecContainer); blockSubcodec = new BlockExpressionSubcodec(this, codecContainer); conditionalSubcodec = new ConditionalExpressionSubcodec(this, codecContainer); constantSubcodec = new ConstantExpressionSubcodec(this, codecContainer); invocationSubcodec = new InvocationExpressionSubcodec(this, codecContainer); lambdaSubcodec = new LambdaExpressionSubcodec(this, codecContainer); listInitSubcodec = new ListInitExpressionSubcodec(this, codecContainer); memberSubcodec = new MemberExpressionSubcodec(this, codecContainer); var memberBindingCollectionCodec = new MemberBindingCollectionCodec(this, codecContainer); memberInitSubcodec = new MemberInitExpressionSubcodec(this, memberBindingCollectionCodec, codecContainer); methodCallSubcodec = new MethodCallExpressionSubcodec(this, codecContainer); newArrayBoundsSubcodec = new NewArrayBoundsExpressionSubcodec(this, codecContainer); newArrayInitSubcodec = new NewArrayInitExpressionSubcodec(this, codecContainer); newSubcodec = new NewExpressionSubcodec(this, codecContainer); parameterSubcodec = new ParameterExpressionSubcodec(this, codecContainer); typeEqualSubcodec = new TypeEqualExpressionSubcodec(this, codecContainer); typeIsSubcodec = new TypeIsExpressionSubcodec(this, codecContainer); unarySubcodec = new UnaryExpressionSubcodec(this, codecContainer); }
public ExceptionCodec(ICodecContainer codecContainer) { stringCodec = codecContainer.GetManualCodecFor <string>(); createException = CreateExceptionCreator(); }
public MethodInfoCodec(ICodecContainer codecContainer) : base(codecContainer) { }
public ReferenceStructArrayCodec(Type elementType, ICodecContainer codecContainer) : base(elementType, codecContainer) { }
public MemberBindingCodec(MemberBindingCollectionCodec memberBindingCollectionCodec, ExpressionCodec expressionCodec, ICodecContainer codecContainer) { memberBindingTypeCodec = codecContainer.GetManualCodecFor <MemberBindingType>(); memberAssignmentCodec = new MemberAssignmentCodec(expressionCodec, codecContainer); memberListBindingCodec = new MemberListBindingCodec(codecContainer); memberMemberBindingCodec = new MemberMemberBindingCodec(memberBindingCollectionCodec, codecContainer); }
public ReferenceArrayCodec(Type type, ICodecContainer codecContainer) { this.type = type; elementCodec = codecContainer.GetEmittingCodecFor(type); isStruct = type.IsValueType; }
public NewArrayInitExpressionSubcodec(ExpressionCodec commonCodec, ICodecContainer codecContainer) : base(commonCodec, codecContainer) { typeCodec = codecContainer.GetManualCodecFor <Type>(); expressionArrayCodec = codecContainer.GetManualCodecFor <Expression[]>(); }
public EventInfoCodec(ICodecContainer codecContainer) : base(codecContainer) { }
public DataContractCodec(Type type, ICodecContainer codecContainer, bool doNotCalculateMaxSize = false) : base(type, codecContainer, doNotCalculateMaxSize) { }
public MemberBindingCollectionCodec(ExpressionCodec expressionCodec, ICodecContainer codecContainer) { memberBindingCodec = new MemberBindingCodec(this, expressionCodec, codecContainer); intCodec = codecContainer.GetManualCodecFor<int>(); }
public ClassArrayCodec(Type elementType, ICodecContainer codecContainer) : base(elementType, codecContainer) { }
public ServiceMethodHandlerFactory(ICodecContainer codecContainer) { this.codecContainer = codecContainer; }
public void Setup() { codecContainer = new CodecContainer(); factory = new ServiceMethodHandlerFactory(codecContainer); service = Substitute.For<IGlobalServiceImplementation>(); var serviceDescriptionBuilder = new ServiceDescriptionBuilder(new MethodDescriptionBuilder()); var globalServiceDescription = serviceDescriptionBuilder.Build(typeof(IGlobalService)); globalServiceImplementationInfo = new ServiceImplementationInfo(typeof(IGlobalService), globalServiceDescription, service); }
public IndirectDataContractCodec(Type type, ICodecContainer codecContainer) : base(type, new DirectDataContractCodec(type, codecContainer)) { }
public void Setup() { serviceDescriptionBuilder = new ServiceDescriptionBuilder(new MethodDescriptionBuilder()); codecContainer = new CodecContainer(); methodCallProcessor = Substitute.For<IOutgoingMethodCallProcessor>(); factory = new ServiceProxyClassFactory(serviceDescriptionBuilder, codecContainer); }
protected ReferenceArrayCodecBase(Type elementType, ICodecContainer codecContainer) : base(elementType.MakeArrayType(), elementType, codecContainer) { }
public ParameterExpressionSubcodec(ExpressionCodec commonCodec, ICodecContainer codecContainer) : base(commonCodec, codecContainer) { typeCodec = codecContainer.GetManualCodecFor <Type>(); stringCodec = codecContainer.GetManualCodecFor <string>(); }
public OutgoingRequestProcessor(IReadOnlyDictionary<string, IServiceTopology> topology, IRequestSenderContainer requestSenderContainer, ICodecContainer codecContainer) { this.topology = topology; this.requestSenderContainer = requestSenderContainer; exceptionCodec = codecContainer.GetManualCodecFor<Exception>(); }
protected ExpressionSubcodecBase(ExpressionCodec commonCodec, ICodecContainer codecContainer) { CommonCodec = commonCodec; CodecContainer = codecContainer; ExpressionTypeCodec = codecContainer.GetManualCodecFor <ExpressionType>(); }
protected CollectionCodecBase(Type type, Type elementType, ICodecContainer codecContainer) { this.type = type; this.elementType = elementType; elementCodec = codecContainer.GetEmittingCodecFor(elementType); }
public OutgoingMethodCallProcessor(IReadOnlyDictionary <string, IServiceTopology> topology, IRequestSenderContainer requestSenderContainer, ICodecContainer codecContainer) { this.topology = topology; this.requestSenderContainer = requestSenderContainer; exceptionCodec = codecContainer.GetManualCodecFor <Exception>(); }
public BinaryExpressionSubcodec(ExpressionCodec commonCodec, ICodecContainer codecContainer) : base(commonCodec, codecContainer) { boolCodec = codecContainer.GetManualCodecFor <bool>(); methodInfoCodec = codecContainer.GetManualCodecFor <MethodInfo>(); }
public IndexExpressionSubcodec(ExpressionCodec commonCodec, ICodecContainer codecContainer) : base(commonCodec, codecContainer) { propertyInfoCodec = codecContainer.GetManualCodecFor <PropertyInfo>(); expressionArrayCodec = codecContainer.GetManualCodecFor <Expression[]>(); }
public TypeEqualExpressionSubcodec(ExpressionCodec commonCodec, ICodecContainer codecContainer) : base(commonCodec, codecContainer) { typeCodec = codecContainer.GetManualCodecFor <Type>(); }