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

Tutorial invokes state change on an assumed static method #255

Closed
KevinBurton opened this issue Mar 9, 2021 · 2 comments
Closed

Tutorial invokes state change on an assumed static method #255

KevinBurton opened this issue Mar 9, 2021 · 2 comments

Comments

@KevinBurton
Copy link

KevinBurton commented Mar 9, 2021

The tutorial indicates

void IncrementCount()
{
    Mediator.Send(new CounterState.IncrementCountAction { Amount = 5 });
}

But in realty the Send method returns a Task and requires a instance of the object. Should the tutorial be updated? So it seems the overall project will not compile. For example when I move this code in my own project I get:
image

namespace BreakpointManagement.Shared.Features.BreakpointManagement
{
    public partial class BreakpointManagementState
    {
        public class UpdateProjectAction : IAction
        {
            public BreakpointProjectSummary Project { get; set; }
        }
    }
}

It seems that to call this method (Send) you have to have an instance of Mediator and the constructor depends on ServiceFactory. So the long and short of it is that I don't know how to create an instance of Mediator?
image

@KevinBurton KevinBurton changed the title Tutorial missed asychronous setting the state Tutorial invokes state change on an assumed static method Mar 10, 2021
@smatthews1999
Copy link

Having this same issue. Anyone?

@StevenTCramer
Copy link
Collaborator

@smatthews1999 @KevinBurton Thanks much for pointing this out. It will run without the await (but that is bad)

I am pushing an update to the library that includes a completed tutorial. Also updated the tutorial docs to use proper async event handler. Thank you.

  async Task  IncrementCount()
  {
    await Mediator.Send(new CounterState.IncrementCountAction { Amount = 5 });
  }

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

3 participants