public GoodsAppService(IGoodsRespository personRespository, IUnitOfWork unitOfWork, IMapper mapper) { _personRespository = personRespository; _unitOfWork = unitOfWork; _mapper = mapper; }
/// <summary> ///异步验证 /// </summary> public static async Task DoValidationAsync(IGoodsRespository goodsRespository, Goods goods, string validatorType) { var goodsValidator = new GoodsValidator(goodsRespository); var validatorReresult = await goodsValidator.DoValidateAsync(goods, validatorType); if (!validatorReresult.IsValid) { throw new DomainException(validatorReresult); } }
public GoodsValidator(IGoodsRespository goodsRespository) { RuleSet(ValidatorTypeConstants.Create, () => { BaseValidator(); }); RuleSet(ValidatorTypeConstants.Modify, () => { BaseValidator(); }); }
/// <summary> ///异步验证 /// </summary> public static async Task DoValidationAsync(IGoodsRespository goodsRespository, IEnumerable <Goods> goodss, string validatorType) { var goodsValidator = new GoodsValidator(goodsRespository); var domainException = new DomainException(); foreach (var goods in goodss) { var validatorReresult = await goodsValidator.DoValidateAsync(goods, validatorType); if (!validatorReresult.IsValid) { domainException.AddErrors(validatorReresult); } } if (domainException.ValidationErrors.ErrorItems.Any()) { throw domainException; } }
public GoodsAppService(IGoodsRespository goodsRespository, IMapper mapper) { _goodsRespository = goodsRespository; _mapper = mapper; }
public GoodsService(IGoodsRespository goodsRespository, IWareHouseRespository wareHouseRespository) { this.goodsRespository = goodsRespository; this.wareHouseRespository = wareHouseRespository; }
public GoodsAppService(IGoodsRespository personRespository, IMapper mapper) { _personRespository = personRespository; _mapper = mapper; }