public CoreSubscription(EmployerMessagingService messageService)
 {
     Name = "Subscription";
     AddField(new EventStreamFieldType
     {
         Name       = "employerAdded",
         Type       = typeof(EmployerAddedMessageType),
         Resolver   = new FuncFieldResolver <EmployerAddedMessage>(c => c.Source as EmployerAddedMessage),
         Subscriber = new EventStreamResolver <EmployerAddedMessage>(c => messageService.GetMessages())
     });
 }
Пример #2
0
        public CoreMutation(TempDBContext database,
                            EmployerMessagingService employerMessageService)
        {
            FieldAsync <EmployerType>(
                "createEmployer",
                arguments: new QueryArguments(new QueryArgument <NonNullGraphType <EmployerInputType> > {
                Name = "employer"
            }),
                resolve: async context =>
            {
                var employer = context.GetArgument <Employer>("employer");
                database.Employers().Add(employer);
                employerMessageService.AddEmployerAddedMessage(employer);

                return(employer);
            });
        }