Ejemplo n.º 1
0
        public ProxyFactory(ProxySetting setting, Type serializerType, Type transmitterType)
        {
            if (serializerType == null)
            {
                throw new ArgumentNullException(nameof(serializerType));
            }
            if (transmitterType == null)
            {
                throw new ArgumentNullException(nameof(transmitterType));
            }

            this.ProxySetting = setting;


            Func <ITransferSerializer> serializerFactory = null;

#if NET40
            NewExpression newSerializerExp = Expression.New(serializerType);
            serializerFactory = Expression.Lambda <Func <ITransferSerializer> >(newSerializerExp).Compile();
#else
            serializerFactory = () =>
            {
                return((ITransferSerializer)Activator.CreateInstance(serializerType));
            };
#endif
            this.SerializerFactory = serializerFactory;


            Func <ITransmitter> transmitterFactory = null;
#if NET40
            NewExpression newTransmitterExp = Expression.New(transmitterType);
            transmitterFactory = Expression.Lambda <Func <ITransmitter> >(newTransmitterExp).Compile();
#else
            transmitterFactory = () =>
            {
                return((ITransmitter)Activator.CreateInstance(transmitterType));
            };
#endif
            this.TransmitterFactory = transmitterFactory;
        }
Ejemplo n.º 2
0
 public ProxyFactory(ProxySetting setting, Func <ITransferSerializer> serializerFactory, Func <ITransmitter> transmitterFactory)
 {
     this.ProxySetting       = setting;
     this.SerializerFactory  = serializerFactory;
     this.TransmitterFactory = transmitterFactory;
 }
Ejemplo n.º 3
0
 public RemoteInvokeHandler(ProxySetting setting, ITransferSerializer serializer, ITransmitter transmitter) : this()
 {
     this.ProxySetting = setting;
     this.Serializer   = serializer;
     this.Transmitter  = transmitter;
 }