Open
Description
Describe the proposal
Currently, if you do something like:
builder.Services.AddActors(options =>
{
options.Actors.RegisterActor<MyActor>(nameof(MyActor));
});
The complete interface hierarchy needs to be compatible with actors. So if you have something like:
public interface IInternalMyActor : IMyActor
{
void SomeInternalMethod()
}
public interface IMyActor: IActor
{
Task SomeMethod()
}
public class MyActor: Actor, IInternalMyActor{
// TODO: implementation
}
If you try to start this actor host you will get the following error message:
: 'Method 'SomeInternalMethod' of actor interface 'MySample.IInternalMyActor ' does not return Task or Task<>. The actor interface methods must be async and must return either Task or Task<>. (Parameter 'actorInterfaceType')'
Error happens at InterfaceDescription:224
.
It would be nice if we would be able to provide at the actor registration another generic parameter which interface should be used to access the actor. So like:
builder.Services.AddActors(options =>
{
options.Actors.RegisterActor<IMyActor, MyActor>(nameof(MyActor));
});
That would make it possible to have a quite complicated structure of interface on an actor. Also it would make it alot easier to use default interface methods
, because you can have an more advanced IActor
interface in your project that just map members from the class Actor
, so you can use it in your default interface methods
.