//TODO: use Linq Expressions so compile a creator //cache the creator /// <summary> /// Creates a new actor using the configured actor producer. /// /// <remarks> /// This method is only useful when called during actor creation by the ActorSystem. /// </remarks> /// </summary> /// <exception cref="TypeLoadException"> /// This exception is thrown if there was an error creating an actor of type <see cref="Props.Type"/> /// with the arguments from <see cref="Props.Arguments"/>. /// </exception> /// <returns>The newly created actor</returns> public virtual ActorBase NewActor() { var type = Type; var arguments = Arguments; try { return(producer.Produce()); } catch (Exception e) { throw new TypeLoadException($"Error while creating actor instance of type {type} with {arguments.Length} args: ({StringFormat.SafeJoin(",", arguments)})", e); } }
//TODO: use Linq Expressions so compile a creator //cache the creator /// <summary> /// Create a new actor instance. This method is only useful when called during /// actor creation by the ActorSystem. /// </summary> /// <returns>ActorBase.</returns> public virtual ActorBase NewActor() { var type = Type; var arguments = Arguments; try { return(producer.Produce()); } catch (Exception e) { throw new Exception("Error while creating actor instance of type " + type + " with " + arguments.Length + " args: (" + StringFormat.SafeJoin(",", arguments) + ")", e); } }