コード例 #1
0
 public VehicleValidator(LocationReadService locationReadService)
 {
     RuleFor(v => v.Vin).NotNull().NotEmpty().Length(17);
     RuleFor(v => v.LocationCode)
     .MustAsync(async
                    (v, l, token) => string.IsNullOrEmpty(l) || await locationReadService.GetLocation(new LocationRequest {
         LocationCode = l
     }, new InMemoryGrpcServerCallContext()) != null)
     .WithMessage(v => $"No location was found for location code: {v.LocationCode}.");
 }
コード例 #2
0
 public VehicleLocationResolver(LocationReadService locationReadService)
 {
     _locationReadService = locationReadService;
 }