public ProjectSubscription(ProjectMessageService messageService) { Name = "Subscription"; AddField(new EventStreamFieldType { Name = "projectAdded", Type = typeof(ProjectAddedMessageType), Resolver = new FuncFieldResolver <ProjectAddedMessage>(c => c.Source as ProjectAddedMessage), Subscriber = new EventStreamResolver <ProjectAddedMessage>(c => messageService.GetMessages()) }); }
public ProductBacklogMutation( IProjectRepository projectsRepository, ProjectMessageService messageService ) { FieldAsync <ProjectType>( "createProject", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <ProjectInputType> > { Name = "project" } ), resolve: async context => { var project = context.GetArgument <ProjectModel>("project"); await context.TryAsyncResolve( async c => await projectsRepository.Add(project) ); messageService.AddProjectAddedMessage(project); return(project); } ); }