public LocPocSubscription(LocationMessageService messageService) { Name = "Subscription"; AddField(new EventStreamFieldType { Name = "locationAdded", Type = typeof(LocationAddedMessageType), Resolver = new FuncFieldResolver <LocationAddedMessage>(c => c.Source as LocationAddedMessage), Subscriber = new EventStreamResolver <LocationAddedMessage>(c => messageService.GetMessages()) }); }
public LocPocMutation(ILocationsRepositoryAsync repository, LocationMessageService messageService) { FieldAsync <LocationType>( "createLocation", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <LocationInputType> > { Name = "location" }), resolve: async context => { var location = context.GetArgument <Location>("location"); await repository.CreateAsync(location); messageService.AddLocationAddedMessage(location); return(location); }); }