fluentvalidation

How to use Reflection in FluentValidation?

无人久伴 提交于 2021-02-06 13:55:15
问题 I have a scneario in which I want to use reflection to do validation using FluentValidation. Someting like this: public class FooValidator : AbstractValidator<Foo> { public FooValidator(Foo obj) { // Iterate properties using reflection var properties = ReflectionHelper.GetShallowPropertiesInfo(obj); foreach (var prop in properties) { // Create rule for each property, based on some data coming from other service... //RuleFor(o => o.Description).NotEmpty().When(o => // this works fine when foo

One Message for rule chain?

你。 提交于 2021-02-06 11:02:33
问题 I'm having an issue with FluentValidation where I want to display one message regardless of the validation error in a given chain. For example, I've defined a validation chain for one property below. I would expect that the chain would be evaluated and any failures would result in the message defined in the WithMessage() call below. However, it seems that it's short-circuiting and only displaying the FluentValidation default error message for the first error encountered. See code below:

One Message for rule chain?

ε祈祈猫儿з 提交于 2021-02-06 10:58:33
问题 I'm having an issue with FluentValidation where I want to display one message regardless of the validation error in a given chain. For example, I've defined a validation chain for one property below. I would expect that the chain would be evaluated and any failures would result in the message defined in the WithMessage() call below. However, it seems that it's short-circuiting and only displaying the FluentValidation default error message for the first error encountered. See code below:

One Message for rule chain?

假如想象 提交于 2021-02-06 10:57:46
问题 I'm having an issue with FluentValidation where I want to display one message regardless of the validation error in a given chain. For example, I've defined a validation chain for one property below. I would expect that the chain would be evaluated and any failures would result in the message defined in the WithMessage() call below. However, it seems that it's short-circuiting and only displaying the FluentValidation default error message for the first error encountered. See code below:

[Abp vNext 入坑分享]

旧城冷巷雨未停 提交于 2020-10-28 03:01:30
前言 由于最近一直在修改一下排版,同时找了非技术的朋友帮忙看一下排版的问题,现在已经基本上确定了排版和样式了。更新可以恢复正常了。 作为一个写前端代码基本只写js不写css的开发,搞排版真的头疼。。各位将就着看吧!!排版并不会太高大上,主要是保证了阅读体验,让各位尽量不会看得头晕眼花而错过了比较重要的内容。希望各位有收获吧!然后后面我会找个时间把之前的文章再重新排版一下。。 简要说明 【项目源码】 【章节目录】 本文主要是介绍如何接入swagger来自动生成api文档。 【Swagger介绍】 首先我们需要知道的是swagger是可以通过xml的格式来进行生成相关的接口文档的,其次VS是可以根据代码的注释进行生成相应的xml的。因此我们可以借助VS的xml文件使swagger生成相关的文档。 再然后一点就是我们要确定我们需要生成文档的项目。根据之前的介绍我们知道我们可以对外输出的项目一个是api是用于接口的;另一个就是application.contract,这个项目主要定义了入参与出参的dto是可以对外输出的。所以我们需要生成swagger的项目就只有这两个。具体步骤如下: 具体步骤 1、选中AbpVnext.Learn.HttpApi项目-》右键-》属性-》生成;然后如下配置输出xml文档 2、然后生成项目,若此项目中存在标准的注释,则会生成相应的xml文件,如下所示: 3