InterfacedActorRef IActorBoundChannelSync.BindActor(InterfacedActorRef actor, ActorBindingFlags bindingFlags)
        {
            if (actor == null)
            {
                throw new ArgumentNullException(nameof(actor));
            }

            var targetActor = actor.CastToIActorRef();

            if (targetActor == null)
            {
                throw new ArgumentException("InterfacedActorRef should have valid IActorRef target.");
            }

            var actorId = BindActor(targetActor, new[] { new BoundType(actor.InterfaceType) }, bindingFlags);

            if (actorId == 0)
            {
                return(null);
            }

            var actorRef = (InterfacedActorRef)Activator.CreateInstance(actor.GetType());

            InterfacedActorRefModifier.SetTarget(actorRef, new BoundActorTarget(actorId));

            return(actorRef);
        }
        InterfacedActorRef IActorBoundChannelSync.BindActor(InterfacedActorRef actor, ActorBindingFlags bindingFlags)
        {
            if (actor == null)
                throw new ArgumentNullException(nameof(actor));

            var targetActor = actor.CastToIActorRef();
            if (targetActor == null)
                throw new ArgumentException("InterfacedActorRef should have valid IActorRef target.");

            var actorId = BindActor(targetActor, new[] { new BoundType(actor.InterfaceType) }, bindingFlags);
            if (actorId == 0)
                return null;

            return actor;
        }
        InterfacedActorRef IActorBoundGatewaySync.OpenChannel(InterfacedActorRef actor, object tag, ActorBindingFlags bindingFlags)
        {
            var targetActor = actor.CastToIActorRef();

            if (targetActor == null)
            {
                throw new ArgumentNullException(nameof(actor));
            }

            var target = ((IActorBoundGatewaySync)this).OpenChannel(targetActor, new TaggedType[] { actor.InterfaceType }, bindingFlags);

            var actorRef = (InterfacedActorRef)Activator.CreateInstance(actor.GetType());

            InterfacedActorRefModifier.SetTarget(actorRef, target);
            return(actorRef);
        }
示例#4
0
        InterfacedActorRef IActorBoundChannelSync.BindActor(InterfacedActorRef actor, ActorBindingFlags bindingFlags)
        {
            if (actor == null)
            {
                throw new ArgumentNullException(nameof(actor));
            }

            var targetActor = actor.CastToIActorRef();

            if (targetActor == null)
            {
                throw new ArgumentException("InterfacedActorRef should have valid IActorRef target.");
            }

            var actorId = BindActor(targetActor, new[] { new BoundType(actor.InterfaceType) }, bindingFlags);

            if (actorId == 0)
            {
                return(null);
            }

            return(actor);
        }
        InterfacedActorRef IActorBoundGatewaySync.OpenChannel(InterfacedActorRef actor, object tag, ActorBindingFlags bindingFlags)
        {
            var targetActor = actor.CastToIActorRef();
            if (targetActor == null)
                throw new ArgumentNullException(nameof(actor));

            var target = ((IActorBoundGatewaySync)this).OpenChannel(targetActor, new TaggedType[] { actor.InterfaceType }, bindingFlags);

            var actorRef = (InterfacedActorRef)Activator.CreateInstance(actor.GetType());
            InterfacedActorRefModifier.SetTarget(actorRef, target);
            return actorRef;
        }
        InterfacedActorRef IActorBoundChannelSync.BindActor(InterfacedActorRef actor, ActorBindingFlags bindingFlags)
        {
            if (actor == null)
                throw new ArgumentNullException(nameof(actor));

            var targetActor = actor.CastToIActorRef();
            if (targetActor == null)
                throw new ArgumentException("InterfacedActorRef should have valid IActorRef target.");

            var actorId = BindActor(targetActor, new[] { new BoundType(actor.InterfaceType) }, bindingFlags);
            if (actorId == 0)
                return null;

            var actorRef = (InterfacedActorRef)Activator.CreateInstance(actor.GetType());
            InterfacedActorRefModifier.SetTarget(actorRef, new BoundActorTarget(actorId));

            return actorRef;
        }