-
Notifications
You must be signed in to change notification settings - Fork 10
Closed
Labels
Description
For example, let's say we have following simple IHelloWorld interface.
public interface IHelloWorld : IInterfacedActor {
Task<string> SayHello(string name);
Task<int> GetHelloCount();
}For writing an actor implementing this interface, simple inheritance would be ok.
public class HelloWorld : InterfacedActor, IHelloWorld {
Task<string> SayHello(string name) { ... }
Task<int> GetHelloCount() { ... }
}However when synchronous handlers are enough, async code could be verbose and inefficient. To handle this we can use an extended interface at a price of losing built-in type safety.
public class HelloWorld : InterfacedActor, IExtendedHandler<IHelloWorld> {
[ExtendedHandler] string SayHello(string name) { ... }
[ExtendedHandler] int GetHelloCount() { ... }
}Instead of extended handler, how about using IHelloWorldSync ? It provides an alternative way to implement sync handlers for interface.
public class HelloWorld : InterfacedActor, IHelloWorldSync {
string SayHello(string name) { ... }
int GetHelloCount() { ... }
}Reactions are currently unavailable