public static ActorPath For(Type interfaceOrClass, string id) { Requires.NotNull(interfaceOrClass, nameof(interfaceOrClass)); Requires.NotNull(id, nameof(id)); if (string.IsNullOrWhiteSpace(id)) { throw new ArgumentException("An actor id cannot be empty or contain whitespace only", nameof(id)); } if (!typeof(IActorGrain).IsAssignableFrom(interfaceOrClass)) { throw new InvalidOperationException($"Type '{interfaceOrClass}' should be a type which implements IActorGrain interface"); } if (!interfaceOrClass.IsInterface) { interfaceOrClass = ActorGrainInterface.InterfaceOf(interfaceOrClass); } return(new ActorPath(interfaceOrClass.FullName, id)); }
/// <summary> /// Returns actual <see cref="IActorGrain"/> interface implemented by give actor class /// </summary> /// <param name="type">The actor class type</param> /// <returns>Type of the interface</returns> public static Type InterfaceOf(Type type) => ActorGrainInterface.InterfaceOf(type);