Esempio n. 1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="actorType">actor type</param>
        /// <param name="actorKey">actor key</param>
        /// <param name="instance">instance of the actor class</param>
        /// <param name="actorProxy">actor proxy</param>
        public ActorInstance(Type actorType, ActorKey actorKey, IActorBase instance, IActor actorProxy)
        {
            actorType.VerifyNotNull(nameof(actorType));
            actorKey.VerifyNotNull(nameof(actorKey));
            instance.VerifyNotNull(nameof(instance));
            actorProxy.VerifyNotNull(nameof(actorProxy));

            ActorType   = actorType;
            ActorKey    = actorKey;
            _instance   = instance;
            _actorProxy = actorProxy;
        }
Esempio n. 2
0
        /// <summary>
        /// Create transparent proxy for instance of actor class
        /// </summary>
        /// <param name="context">work context</param>
        /// <param name="instance">instance of actor class</param>
        /// <param name="manager">actor manager</param>
        /// <returns>proxy</returns>
        public static T Create(IActorBase instance, ActorHost actorHost)
        {
            instance.VerifyNotNull(nameof(instance));
            actorHost.VerifyNotNull(nameof(actorHost));

            object proxyObject = Create <T, ActorProxy <T> >();

            ActorProxy <T> proxy = (ActorProxy <T>)proxyObject;

            proxy._instance  = instance;
            proxy._actorHost = actorHost;

            return((T)proxyObject);
        }