コード例 #1
0
        public LockQueries(LockRead.LockReadClient lockReadClient)
        {
            FieldAsync <LockType>(nameof(Contracts.Lock),
                                  "a lock",
                                  new QueryArguments(new QueryArgument(typeof(StringGraphType))
            {
                Name = "resourceId"
            }
                                                     ),
                                  async ctx => await ctx.TryAsyncResolve(async context =>
                                                                         await lockReadClient.GetLockAsync(
                                                                             new LockRequest
            {
                ResourceId = ctx.Arguments["resourceId"].ToString()
            }
                                                                             )
                                                                         ));

            // FieldAsync<ListGraphType<LockType>>("locks",
            //     "all locks",
            //     null,
            //     async ctx => await ctx.TryAsyncResolve(async context =>
            //     {
            //         var response = await locationReadClient.GetAllLocationsAsync(new Empty());
            //         return response.Elements;
            //     }));
        }
コード例 #2
0
        public LockSubscription(LockRead.LockReadClient lockReadClient)
        {
            _lockReadClient = lockReadClient;

            AddField(new EventStreamFieldType
            {
                Name       = "lockExpire",
                Type       = typeof(LockType),
                Resolver   = new FuncFieldResolver <Contracts.Lock>(ctx => ctx.Source as Contracts.Lock),
                Subscriber = new EventStreamResolver <Contracts.Lock>(GetLockChangeSubscription)
            });
        }
コード例 #3
0
 public VehicleLockResolver(LockRead.LockReadClient lockReadClient) => _lockReadClient = lockReadClient;