/// <summary> ///异步验证 /// </summary> private async Task DoValidationAsync(IEnumerable <OrderInfo> orderInfos, string validatorType) { var orderInfoValidator = new OrderInfoValidator(); var domainException = new DomainException(); foreach (var orderInfo in orderInfos) { var validatorReresult = await orderInfoValidator.DoValidateAsync(orderInfo, validatorType); if (!validatorReresult.IsValid) { domainException.AddErrors(validatorReresult); } } if (domainException.ValidationErrors.ErrorItems.Any()) { throw domainException; } }
/// <summary> ///异步验证 /// </summary> public static async Task DoValidationAsync(IEmployeeRespository employeeRespository, IEnumerable <Employee> employees, string validatorType) { var employeeValidator = new EmployeeValidator(employeeRespository); var domainException = new DomainException(); foreach (var employee in employees) { var validatorReresult = await employeeValidator.DoValidateAsync(employee, validatorType); if (!validatorReresult.IsValid) { domainException.AddErrors(validatorReresult); } } if (domainException.ValidationErrors.ErrorItems.Any()) { throw domainException; } }
/// <summary> ///异步验证 /// </summary> public static async Task DoValidationAsync(IRoleRespository roleRespository, IEnumerable <Role> roles, string validatorType) { var roleValidator = new RoleValidator(roleRespository); var domainException = new DomainException(); foreach (var role in roles) { var validatorReresult = await roleValidator.DoValidateAsync(role, validatorType); if (!validatorReresult.IsValid) { domainException.AddErrors(validatorReresult); } } if (domainException.ValidationErrors.ErrorItems.Any()) { throw domainException; } }
/// <summary> ///异步验证 /// </summary> public static async Task DoValidationAsync(IModuleElementRespository moduleElementRespository, IEnumerable <ModuleElement> moduleElements, string validatorType) { var moduleElementValidator = new ModuleElementValidator(moduleElementRespository); var domainException = new DomainException(); foreach (var moduleElement in moduleElements) { var validatorReresult = await moduleElementValidator.DoValidateAsync(moduleElement, validatorType); if (!validatorReresult.IsValid) { domainException.AddErrors(validatorReresult); } } if (domainException.ValidationErrors.ErrorItems.Any()) { throw domainException; } }
/// <summary> ///异步验证 /// </summary> public static async Task DoValidationAsync(IOrganizationRespository organizationRespository, IEnumerable <Organization> organizations, string validatorType) { var organizationValidator = new OrganizationValidator(organizationRespository); var domainException = new DomainException(); foreach (var organization in organizations) { var validatorReresult = await organizationValidator.DoValidateAsync(organization, validatorType); if (!validatorReresult.IsValid) { domainException.AddErrors(validatorReresult); } } if (domainException.ValidationErrors.ErrorItems.Any()) { throw domainException; } }
/// <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; } }
/// <summary> ///异步验证 /// </summary> public static async Task DoValidationAsync(IMenuRespository menuRespository, IEnumerable <Menu> menus, string validatorType) { var menuValidator = new MenuValidator(menuRespository); var domainException = new DomainException(); foreach (var menu in menus) { var validatorReresult = await menuValidator.DoValidateAsync(menu, validatorType); if (!validatorReresult.IsValid) { domainException.AddErrors(validatorReresult); } } if (domainException.ValidationErrors.ErrorItems.Any()) { throw domainException; } }
/// <summary> ///异步验证 /// </summary> public static async Task DoValidationAsync(IUsersRespository usersRespository, IEnumerable <Users> userss, string validatorType) { var usersValidator = new UsersValidator(usersRespository); var domainException = new DomainException(); foreach (var users in userss) { var validatorReresult = await usersValidator.DoValidateAsync(users, validatorType); if (!validatorReresult.IsValid) { domainException.AddErrors(validatorReresult); } } if (domainException.ValidationErrors.ErrorItems.Any()) { throw domainException; } }