Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to implement reminders for my own StateProvider implementation #345

Open
ssteinau opened this issue Sep 27, 2022 · 0 comments
Open

Comments

@ssteinau
Copy link

ssteinau commented Sep 27, 2022

Describe the bug
ActorService allows implementing custom actor state providers. The Interface IActorStateProvider requires implementing the method

    Task<ReminderPagedResult<KeyValuePair<ActorId, List<ActorReminderState>>>> GetRemindersAsync(
        int numItemsToReturn, ...); // parameters omitted for brevity

The problem is in the return type "List<ActorReminderState>". ActorReminderState is public non-sealed class and as such can be subclassed, yet its constructor is internal - One cannot create instances of the subclass.

Related issues cascade through the code as well:.ActorStateReminder constructor parameters are internal classes as well,
To Reproduce

Create new project, import the actors NuGet package, create a subclass of ActorReminder state with a 3-param constructor that calls the base class. Compiler error because the base class constructor is internal. Example:

public class SubActorReminderState : ActorReminderState, IActorReminderState
{

  /*Properties
  */
  //Constructor
    public SubActorReminderState(ActorReminderData reminder, TimeSpan currentLogicalTime, ReminderCompletedData reminderCompletedData) : base(reminder,currentLogicalTime,reminderCompletedData) //calling base gives compiler error

Expected behavior

Be able to implement reminders for the state provider.
Possible solutions:

  • Make the ActorReminderState constructor and parameter classes public
  • Make GetRemindersAsync return List<IActorReminderState>

Additional context

  • There is an Interface IActorReminderState that ActorReminderState implements. The new signature of GetRemindersAsync could be

      Task<ReminderPagedResult<KeyValuePair<ActorId, List<IActorReminderState>>>> GetRemindersAsync(
          int numItemsToReturn, ...); // parameters omitted for brevity
    

and a user can then implement the IActorReminderState interface, ActorReminderState can stay as-is.

Caveat: the interface would have to include additional properties and methods, non-interface properties and methods of ActorReminderState are used throughout the project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant