翼度科技»论坛 编程开发 .net 查看内容

FluentValidation在C# WPF中的应用

4

主题

4

帖子

12

积分

新手上路

Rank: 1

积分
12
1. 引言

在.NET开发领域,FluentValidation以其优雅、易扩展的特性成为开发者进行属性验证的首选工具。它不仅适用于Web开发,如MVC、Web API和ASP.NET CORE,同样也能完美集成在WPF应用程序中,提供强大的数据验证功能。本文将深入探讨如何在C# WPF项目中运用FluentValidation进行属性验证,并展示如何通过MVVM模式实现这一功能。
2. 功能概览

我们的目标是构建一个WPF应用程序,它能够通过FluentValidation实现以下验证功能:

  • 验证ViewModel层的基本数据类型属性,如int、string等。
  • 对ViewModel中的复杂属性进行验证,这包括对象属性的子属性以及集合属性。
  • 提供两种直观的错误提示样式,以增强用户体验。
先看实现效果图:

3. 解决问题与探索

在调研过程中,我发现FluentValidation官方文档主要关注于Web应用的验证。对于WPF和复杂属性的验证,官方文档提供的示例有限。然而,通过深入研究和实践,我找到了将FluentValidation与WPF结合使用的有效方法,特别是针对复杂属性的验证。
4. 开发步骤

4.1. 创建工程、库引入

首先,创建一个新的WPF项目,并引入FluentValidation库用于属性验证,以及Prism.Wpf库以简化MVVM模式的实现。
  1. <ItemGroup>
  2.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  3.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  4. </ItemGroup>
复制代码
4.2. 创建实体类

我创建了两个实体类:Student和Field,分别代表对象属性和集合项属性。这两个类都实现了IDataErrorInfo接口:

  • IDataErrorInfo接口常用于提供实体数据验证的错误信息。这个接口包含两个成员:一个索引器(this[string columnName])和一个Error属性。索引器用于按属性名称提供错误信息,而Error属性则用于提供整个实体的错误概述。
  • 两个实体类和另外在后面提及的ViewModel中也实现IDataErrorInfo接口,并在this[string columnName]索引器和Error属性中使用FluentValidation来验证属性。
4.2.1. 普通类 - Student

学生类包含5个属性:名字、年龄、邮政编码、最小值和最大值,其中最小值和最大值涉及关联验证,即最小值变化后通知最大值验证,反之同理。
  1. /// ///<ItemGroup>
  2.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  3.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  4. </ItemGroup> 学生实体///<ItemGroup>
  5.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  6.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  7. </ItemGroup> 继承BindableBase,即继承属性变化接口INotifyPropertyChanged///<ItemGroup>
  8.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  9.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  10. </ItemGroup> 实现IDataErrorInfo接口,用于FluentValidation验证,必须实现此接口/// public class Student : BindableBase, IDataErrorInfo{<ItemGroup>
  11.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  12.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  13. </ItemGroup>private int _age;<ItemGroup>
  14.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  15.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  16. </ItemGroup>private string? _name;<ItemGroup>
  17.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  18.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  19. </ItemGroup>private string? _zip;<ItemGroup>
  20.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  21.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  22. </ItemGroup>private readonly StudentValidator _validator = new();<ItemGroup>
  23.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  24.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  25. </ItemGroup>public string? Name<ItemGroup>
  26.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  27.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  28. </ItemGroup>{<ItemGroup>
  29.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  30.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  31. </ItemGroup><ItemGroup>
  32.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  33.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  34. </ItemGroup>get => _name;<ItemGroup>
  35.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  36.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  37. </ItemGroup><ItemGroup>
  38.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  39.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  40. </ItemGroup>set => SetProperty(ref _name, value);<ItemGroup>
  41.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  42.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  43. </ItemGroup>}<ItemGroup>
  44.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  45.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  46. </ItemGroup>public int Age<ItemGroup>
  47.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  48.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  49. </ItemGroup>{<ItemGroup>
  50.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  51.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  52. </ItemGroup><ItemGroup>
  53.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  54.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  55. </ItemGroup>get => _age;<ItemGroup>
  56.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  57.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  58. </ItemGroup><ItemGroup>
  59.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  60.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  61. </ItemGroup>set => SetProperty(ref _age, value);<ItemGroup>
  62.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  63.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  64. </ItemGroup>}<ItemGroup>
  65.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  66.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  67. </ItemGroup>public string? Zip<ItemGroup>
  68.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  69.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  70. </ItemGroup>{<ItemGroup>
  71.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  72.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  73. </ItemGroup><ItemGroup>
  74.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  75.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  76. </ItemGroup>get => _zip;<ItemGroup>
  77.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  78.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  79. </ItemGroup><ItemGroup>
  80.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  81.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  82. </ItemGroup>set => SetProperty(ref _zip, value);<ItemGroup>
  83.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  84.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  85. </ItemGroup>}<ItemGroup>
  86.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  87.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  88. </ItemGroup>private int _minValue;<ItemGroup>
  89.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  90.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  91. </ItemGroup>public int MinValue<ItemGroup>
  92.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  93.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  94. </ItemGroup>{<ItemGroup>
  95.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  96.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  97. </ItemGroup><ItemGroup>
  98.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  99.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  100. </ItemGroup>get => _minValue;<ItemGroup>
  101.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  102.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  103. </ItemGroup><ItemGroup>
  104.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  105.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  106. </ItemGroup>set<ItemGroup>
  107.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  108.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  109. </ItemGroup><ItemGroup>
  110.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  111.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  112. </ItemGroup>{<ItemGroup>
  113.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  114.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  115. </ItemGroup><ItemGroup>
  116.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  117.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  118. </ItemGroup><ItemGroup>
  119.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  120.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  121. </ItemGroup>SetProperty(ref _minValue, value);<ItemGroup>
  122.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  123.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  124. </ItemGroup><ItemGroup>
  125.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  126.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  127. </ItemGroup><ItemGroup>
  128.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  129.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  130. </ItemGroup>// 关联更新最大值验证<ItemGroup>
  131.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  132.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  133. </ItemGroup><ItemGroup>
  134.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  135.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  136. </ItemGroup><ItemGroup>
  137.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  138.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  139. </ItemGroup>RaisePropertyChanged(nameof(MaxValue));<ItemGroup>
  140.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  141.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  142. </ItemGroup><ItemGroup>
  143.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  144.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  145. </ItemGroup>}<ItemGroup>
  146.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  147.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  148. </ItemGroup>}<ItemGroup>
  149.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  150.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  151. </ItemGroup>private int _maxValue;<ItemGroup>
  152.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  153.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  154. </ItemGroup>public int MaxValue<ItemGroup>
  155.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  156.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  157. </ItemGroup>{<ItemGroup>
  158.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  159.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  160. </ItemGroup><ItemGroup>
  161.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  162.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  163. </ItemGroup>get => _maxValue;<ItemGroup>
  164.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  165.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  166. </ItemGroup><ItemGroup>
  167.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  168.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  169. </ItemGroup>set<ItemGroup>
  170.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  171.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  172. </ItemGroup><ItemGroup>
  173.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  174.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  175. </ItemGroup>{<ItemGroup>
  176.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  177.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  178. </ItemGroup><ItemGroup>
  179.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  180.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  181. </ItemGroup><ItemGroup>
  182.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  183.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  184. </ItemGroup>SetProperty(ref _maxValue, value);<ItemGroup>
  185.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  186.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  187. </ItemGroup><ItemGroup>
  188.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  189.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  190. </ItemGroup><ItemGroup>
  191.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  192.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  193. </ItemGroup>// 关联更新最小值验证<ItemGroup>
  194.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  195.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  196. </ItemGroup><ItemGroup>
  197.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  198.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  199. </ItemGroup><ItemGroup>
  200.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  201.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  202. </ItemGroup>RaisePropertyChanged(nameof(MinValue));<ItemGroup>
  203.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  204.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  205. </ItemGroup><ItemGroup>
  206.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  207.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  208. </ItemGroup>}<ItemGroup>
  209.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  210.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  211. </ItemGroup>}<ItemGroup>
  212.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  213.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  214. </ItemGroup>public string this[string columnName]<ItemGroup>
  215.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  216.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  217. </ItemGroup>{<ItemGroup>
  218.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  219.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  220. </ItemGroup><ItemGroup>
  221.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  222.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  223. </ItemGroup>get<ItemGroup>
  224.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  225.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  226. </ItemGroup><ItemGroup>
  227.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  228.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  229. </ItemGroup>{<ItemGroup>
  230.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  231.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  232. </ItemGroup><ItemGroup>
  233.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  234.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  235. </ItemGroup><ItemGroup>
  236.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  237.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  238. </ItemGroup>var validateResult = _validator.Validate(this);<ItemGroup>
  239.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  240.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  241. </ItemGroup><ItemGroup>
  242.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  243.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  244. </ItemGroup><ItemGroup>
  245.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  246.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  247. </ItemGroup>if (validateResult.IsValid)<ItemGroup>
  248.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  249.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  250. </ItemGroup><ItemGroup>
  251.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  252.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  253. </ItemGroup><ItemGroup>
  254.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  255.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  256. </ItemGroup>{<ItemGroup>
  257.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  258.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  259. </ItemGroup><ItemGroup>
  260.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  261.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  262. </ItemGroup><ItemGroup>
  263.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  264.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  265. </ItemGroup><ItemGroup>
  266.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  267.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  268. </ItemGroup>return string.Empty;<ItemGroup>
  269.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  270.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  271. </ItemGroup><ItemGroup>
  272.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  273.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  274. </ItemGroup><ItemGroup>
  275.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  276.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  277. </ItemGroup>}<ItemGroup>
  278.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  279.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  280. </ItemGroup><ItemGroup>
  281.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  282.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  283. </ItemGroup><ItemGroup>
  284.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  285.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  286. </ItemGroup>var firstOrDefault =<ItemGroup>
  287.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  288.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  289. </ItemGroup><ItemGroup>
  290.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  291.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  292. </ItemGroup><ItemGroup>
  293.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  294.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  295. </ItemGroup><ItemGroup>
  296.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  297.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  298. </ItemGroup>validateResult.Errors.FirstOrDefault(error => error.PropertyName == columnName);<ItemGroup>
  299.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  300.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  301. </ItemGroup><ItemGroup>
  302.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  303.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  304. </ItemGroup><ItemGroup>
  305.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  306.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  307. </ItemGroup>return firstOrDefault == null ? string.Empty : firstOrDefault.ErrorMessage;<ItemGroup>
  308.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  309.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  310. </ItemGroup><ItemGroup>
  311.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  312.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  313. </ItemGroup>}<ItemGroup>
  314.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  315.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  316. </ItemGroup>}<ItemGroup>
  317.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  318.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  319. </ItemGroup>public string Error<ItemGroup>
  320.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  321.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  322. </ItemGroup>{<ItemGroup>
  323.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  324.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  325. </ItemGroup><ItemGroup>
  326.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  327.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  328. </ItemGroup>get<ItemGroup>
  329.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  330.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  331. </ItemGroup><ItemGroup>
  332.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  333.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  334. </ItemGroup>{<ItemGroup>
  335.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  336.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  337. </ItemGroup><ItemGroup>
  338.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  339.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  340. </ItemGroup><ItemGroup>
  341.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  342.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  343. </ItemGroup>var validateResult = _validator.Validate(this);<ItemGroup>
  344.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  345.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  346. </ItemGroup><ItemGroup>
  347.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  348.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  349. </ItemGroup><ItemGroup>
  350.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  351.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  352. </ItemGroup>if (validateResult.IsValid)<ItemGroup>
  353.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  354.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  355. </ItemGroup><ItemGroup>
  356.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  357.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  358. </ItemGroup><ItemGroup>
  359.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  360.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  361. </ItemGroup>{<ItemGroup>
  362.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  363.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  364. </ItemGroup><ItemGroup>
  365.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  366.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  367. </ItemGroup><ItemGroup>
  368.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  369.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  370. </ItemGroup><ItemGroup>
  371.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  372.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  373. </ItemGroup>return string.Empty;<ItemGroup>
  374.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  375.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  376. </ItemGroup><ItemGroup>
  377.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  378.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  379. </ItemGroup><ItemGroup>
  380.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  381.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  382. </ItemGroup>}<ItemGroup>
  383.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  384.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  385. </ItemGroup><ItemGroup>
  386.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  387.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  388. </ItemGroup><ItemGroup>
  389.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  390.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  391. </ItemGroup>var errors = string.Join(Environment.NewLine, validateResult.Errors.Select(x => x.ErrorMessage).ToArray());<ItemGroup>
  392.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  393.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  394. </ItemGroup><ItemGroup>
  395.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  396.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  397. </ItemGroup><ItemGroup>
  398.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  399.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  400. </ItemGroup>return errors;<ItemGroup>
  401.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  402.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  403. </ItemGroup><ItemGroup>
  404.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  405.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  406. </ItemGroup>}<ItemGroup>
  407.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  408.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  409. </ItemGroup>}}
复制代码
上面关键代码在public string this[string columnName]:这里进行输入表单项的数据校验,FluentValidation调用就在这里,校验逻辑封装在StudentValidator,表单输入时会实时调用该处代码,columnName表示表单项的列名,就是View绑定的属性名。
4.2.2. 集合类 - Field

此类用作ViewModel中的集合项使用,模拟动态表单数据校验,简单包含4个属性:字段名称、字段显示名称、数据类型、数据值,表单主要根据数据类型验证输入的数据值是否合法。同样此实体需要继承IDataErrorInfo接口,用于触发FluentValidation验证使用。
  1. /// ///<ItemGroup>
  2.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  3.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  4. </ItemGroup> 扩展字段,用于生成动态表单///<ItemGroup>
  5.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  6.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  7. </ItemGroup> 继承BindableBase,即继承属性变化接口INotifyPropertyChanged///<ItemGroup>
  8.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  9.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  10. </ItemGroup> 实现IDataErrorInfo接口,用于FluentValidation验证,必须实现此接口/// public class Field : BindableBase, IDataErrorInfo{<ItemGroup>
  11.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  12.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  13. </ItemGroup>private string? _value;<ItemGroup>
  14.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  15.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  16. </ItemGroup>private readonly FieldValidator _validator = new();<ItemGroup>
  17.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  18.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  19. </ItemGroup>public Field(DataType type, string typeLabel, string name, string value)<ItemGroup>
  20.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  21.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  22. </ItemGroup>{<ItemGroup>
  23.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  24.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  25. </ItemGroup><ItemGroup>
  26.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  27.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  28. </ItemGroup>Type = type;<ItemGroup>
  29.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  30.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  31. </ItemGroup><ItemGroup>
  32.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  33.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  34. </ItemGroup>TypeLabel = typeLabel;<ItemGroup>
  35.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  36.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  37. </ItemGroup><ItemGroup>
  38.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  39.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  40. </ItemGroup>Name = name;<ItemGroup>
  41.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  42.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  43. </ItemGroup><ItemGroup>
  44.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  45.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  46. </ItemGroup>Value = value;<ItemGroup>
  47.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  48.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  49. </ItemGroup>}<ItemGroup>
  50.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  51.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  52. </ItemGroup>///<ItemGroup>
  53.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  54.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  55. </ItemGroup> ///<ItemGroup>
  56.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  57.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  58. </ItemGroup> 数据类型<ItemGroup>
  59.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  60.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  61. </ItemGroup>///<ItemGroup>
  62.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  63.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  64. </ItemGroup> public DataType Type { get; set; }<ItemGroup>
  65.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  66.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  67. </ItemGroup>///<ItemGroup>
  68.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  69.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  70. </ItemGroup> ///<ItemGroup>
  71.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  72.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  73. </ItemGroup> 数据类型名称<ItemGroup>
  74.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  75.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  76. </ItemGroup>///<ItemGroup>
  77.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  78.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  79. </ItemGroup> public string TypeLabel { get; set; }<ItemGroup>
  80.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  81.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  82. </ItemGroup>///<ItemGroup>
  83.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  84.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  85. </ItemGroup> ///<ItemGroup>
  86.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  87.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  88. </ItemGroup> 名称<ItemGroup>
  89.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  90.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  91. </ItemGroup>///<ItemGroup>
  92.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  93.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  94. </ItemGroup> public string Name { get; set; }<ItemGroup>
  95.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  96.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  97. </ItemGroup>///<ItemGroup>
  98.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  99.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  100. </ItemGroup> ///<ItemGroup>
  101.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  102.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  103. </ItemGroup> 值<ItemGroup>
  104.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  105.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  106. </ItemGroup>///<ItemGroup>
  107.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  108.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  109. </ItemGroup> public string? Value<ItemGroup>
  110.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  111.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  112. </ItemGroup>{<ItemGroup>
  113.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  114.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  115. </ItemGroup><ItemGroup>
  116.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  117.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  118. </ItemGroup>get => _value;<ItemGroup>
  119.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  120.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  121. </ItemGroup><ItemGroup>
  122.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  123.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  124. </ItemGroup>set => SetProperty(ref _value, value);<ItemGroup>
  125.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  126.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  127. </ItemGroup>}<ItemGroup>
  128.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  129.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  130. </ItemGroup>public string this[string columnName]<ItemGroup>
  131.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  132.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  133. </ItemGroup>{<ItemGroup>
  134.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  135.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  136. </ItemGroup><ItemGroup>
  137.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  138.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  139. </ItemGroup>get<ItemGroup>
  140.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  141.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  142. </ItemGroup><ItemGroup>
  143.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  144.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  145. </ItemGroup>{<ItemGroup>
  146.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  147.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  148. </ItemGroup><ItemGroup>
  149.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  150.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  151. </ItemGroup><ItemGroup>
  152.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  153.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  154. </ItemGroup>var validateResult = _validator.Validate(this);<ItemGroup>
  155.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  156.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  157. </ItemGroup><ItemGroup>
  158.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  159.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  160. </ItemGroup><ItemGroup>
  161.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  162.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  163. </ItemGroup>if (validateResult.IsValid)<ItemGroup>
  164.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  165.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  166. </ItemGroup><ItemGroup>
  167.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  168.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  169. </ItemGroup><ItemGroup>
  170.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  171.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  172. </ItemGroup>{<ItemGroup>
  173.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  174.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  175. </ItemGroup><ItemGroup>
  176.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  177.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  178. </ItemGroup><ItemGroup>
  179.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  180.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  181. </ItemGroup><ItemGroup>
  182.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  183.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  184. </ItemGroup>return string.Empty;<ItemGroup>
  185.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  186.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  187. </ItemGroup><ItemGroup>
  188.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  189.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  190. </ItemGroup><ItemGroup>
  191.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  192.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  193. </ItemGroup>}<ItemGroup>
  194.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  195.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  196. </ItemGroup><ItemGroup>
  197.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  198.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  199. </ItemGroup><ItemGroup>
  200.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  201.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  202. </ItemGroup>var firstOrDefault =<ItemGroup>
  203.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  204.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  205. </ItemGroup><ItemGroup>
  206.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  207.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  208. </ItemGroup><ItemGroup>
  209.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  210.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  211. </ItemGroup><ItemGroup>
  212.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  213.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  214. </ItemGroup>validateResult.Errors.FirstOrDefault(error => error.PropertyName == columnName);<ItemGroup>
  215.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  216.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  217. </ItemGroup><ItemGroup>
  218.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  219.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  220. </ItemGroup><ItemGroup>
  221.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  222.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  223. </ItemGroup>return firstOrDefault == null ? string.Empty : firstOrDefault.ErrorMessage;<ItemGroup>
  224.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  225.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  226. </ItemGroup><ItemGroup>
  227.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  228.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  229. </ItemGroup>}<ItemGroup>
  230.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  231.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  232. </ItemGroup>}<ItemGroup>
  233.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  234.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  235. </ItemGroup>public string Error<ItemGroup>
  236.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  237.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  238. </ItemGroup>{<ItemGroup>
  239.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  240.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  241. </ItemGroup><ItemGroup>
  242.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  243.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  244. </ItemGroup>get<ItemGroup>
  245.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  246.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  247. </ItemGroup><ItemGroup>
  248.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  249.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  250. </ItemGroup>{<ItemGroup>
  251.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  252.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  253. </ItemGroup><ItemGroup>
  254.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  255.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  256. </ItemGroup><ItemGroup>
  257.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  258.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  259. </ItemGroup>var validateResult = _validator.Validate(this);<ItemGroup>
  260.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  261.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  262. </ItemGroup><ItemGroup>
  263.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  264.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  265. </ItemGroup><ItemGroup>
  266.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  267.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  268. </ItemGroup>if (validateResult.IsValid)<ItemGroup>
  269.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  270.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  271. </ItemGroup><ItemGroup>
  272.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  273.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  274. </ItemGroup><ItemGroup>
  275.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  276.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  277. </ItemGroup>{<ItemGroup>
  278.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  279.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  280. </ItemGroup><ItemGroup>
  281.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  282.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  283. </ItemGroup><ItemGroup>
  284.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  285.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  286. </ItemGroup><ItemGroup>
  287.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  288.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  289. </ItemGroup>return string.Empty;<ItemGroup>
  290.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  291.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  292. </ItemGroup><ItemGroup>
  293.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  294.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  295. </ItemGroup><ItemGroup>
  296.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  297.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  298. </ItemGroup>}<ItemGroup>
  299.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  300.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  301. </ItemGroup><ItemGroup>
  302.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  303.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  304. </ItemGroup><ItemGroup>
  305.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  306.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  307. </ItemGroup>var errors = string.Join(Environment.NewLine, validateResult.Errors.Select(x => x.ErrorMessage).ToArray());<ItemGroup>
  308.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  309.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  310. </ItemGroup><ItemGroup>
  311.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  312.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  313. </ItemGroup><ItemGroup>
  314.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  315.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  316. </ItemGroup>return errors;<ItemGroup>
  317.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  318.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  319. </ItemGroup><ItemGroup>
  320.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  321.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  322. </ItemGroup>}<ItemGroup>
  323.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  324.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  325. </ItemGroup>}}public enum DataType{<ItemGroup>
  326.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  327.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  328. </ItemGroup>Text,<ItemGroup>
  329.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  330.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  331. </ItemGroup>Number,<ItemGroup>
  332.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  333.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  334. </ItemGroup>Date}
复制代码
看上面代码,public string this[string columnName]代码处写法和Student类一样,只是_validator变量类型不同,前者为StudentValidator,这里是FieldValidator,下面我们看看这两个类怎么写。
4.3. 创建验证器

对于每个实体类,我都创建了一个对应的验证器类:StudentValidator和FieldValidator。这些验证器类继承自AbstractValidator,并在其中定义了验证规则。验证属性的写法有两种:

  • 可以在实体属性上方添加特性(本文不作特别说明,百度文章介绍很多);
  • 通过代码的形式添加,如下方,创建一个验证器类,继承自AbstractValidator,在此验证器构造函数中写规则验证属性,方便管理。
本文使用第二种,下面通过创建StudentValidator和FieldValidator两个验证器类介绍。
4.3.1. StudentValidator

这是学生验证器StudentValidator,需要继承AbstractValidator,泛型指定前面需要验证的实体类Student:
  1. public class StudentValidator : AbstractValidator{<ItemGroup>
  2.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  3.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  4. </ItemGroup>public StudentValidator()<ItemGroup>
  5.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  6.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  7. </ItemGroup>{<ItemGroup>
  8.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  9.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  10. </ItemGroup><ItemGroup>
  11.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  12.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  13. </ItemGroup>RuleFor(vm => vm.Name)<ItemGroup>
  14.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  15.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  16. </ItemGroup><ItemGroup>
  17.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  18.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  19. </ItemGroup><ItemGroup>
  20.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  21.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  22. </ItemGroup>.NotEmpty()<ItemGroup>
  23.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  24.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  25. </ItemGroup><ItemGroup>
  26.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  27.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  28. </ItemGroup><ItemGroup>
  29.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  30.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  31. </ItemGroup>.WithMessage("请输入学生姓名!")<ItemGroup>
  32.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  33.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  34. </ItemGroup><ItemGroup>
  35.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  36.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  37. </ItemGroup><ItemGroup>
  38.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  39.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  40. </ItemGroup>.Length(5, 30)<ItemGroup>
  41.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  42.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  43. </ItemGroup><ItemGroup>
  44.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  45.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  46. </ItemGroup><ItemGroup>
  47.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  48.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  49. </ItemGroup>.WithMessage("学生姓名长度限制在5到30个字符之间!");<ItemGroup>
  50.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  51.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  52. </ItemGroup><ItemGroup>
  53.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  54.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  55. </ItemGroup>RuleFor(vm => vm.Age)<ItemGroup>
  56.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  57.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  58. </ItemGroup><ItemGroup>
  59.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  60.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  61. </ItemGroup><ItemGroup>
  62.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  63.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  64. </ItemGroup>.GreaterThanOrEqualTo(0)<ItemGroup>
  65.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  66.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  67. </ItemGroup><ItemGroup>
  68.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  69.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  70. </ItemGroup><ItemGroup>
  71.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  72.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  73. </ItemGroup>.WithMessage("学生年龄为整数!")<ItemGroup>
  74.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  75.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  76. </ItemGroup><ItemGroup>
  77.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  78.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  79. </ItemGroup><ItemGroup>
  80.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  81.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  82. </ItemGroup>.ExclusiveBetween(10, 150)<ItemGroup>
  83.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  84.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  85. </ItemGroup><ItemGroup>
  86.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  87.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  88. </ItemGroup><ItemGroup>
  89.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  90.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  91. </ItemGroup>.WithMessage("请正确输入学生年龄(10-150)");<ItemGroup>
  92.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  93.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  94. </ItemGroup><ItemGroup>
  95.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  96.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  97. </ItemGroup>_ = RuleFor(vm => vm.Zip)<ItemGroup>
  98.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  99.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  100. </ItemGroup><ItemGroup>
  101.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  102.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  103. </ItemGroup><ItemGroup>
  104.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  105.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  106. </ItemGroup>.NotEmpty()<ItemGroup>
  107.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  108.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  109. </ItemGroup><ItemGroup>
  110.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  111.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  112. </ItemGroup><ItemGroup>
  113.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  114.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  115. </ItemGroup>.WithMessage("邮政编码不能为空!")<ItemGroup>
  116.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  117.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  118. </ItemGroup><ItemGroup>
  119.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  120.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  121. </ItemGroup><ItemGroup>
  122.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  123.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  124. </ItemGroup>.Must(BeAValidZip)<ItemGroup>
  125.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  126.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  127. </ItemGroup><ItemGroup>
  128.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  129.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  130. </ItemGroup><ItemGroup>
  131.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  132.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  133. </ItemGroup>.WithMessage("邮政编码由六位数字组成。");<ItemGroup>
  134.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  135.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  136. </ItemGroup><ItemGroup>
  137.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  138.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  139. </ItemGroup>RuleFor(model => model.MinValue).Must((model, minValue) => minValue < model.MaxValue).WithMessage("最小值应该小于最大值");<ItemGroup>
  140.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  141.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  142. </ItemGroup><ItemGroup>
  143.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  144.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  145. </ItemGroup>RuleFor(model => model.MaxValue).Must((model, maxValue) => maxValue > model.MinValue).WithMessage("最大值应该大于最小值");<ItemGroup>
  146.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  147.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  148. </ItemGroup>}<ItemGroup>
  149.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  150.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  151. </ItemGroup>private static bool BeAValidZip(string? zip)<ItemGroup>
  152.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  153.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  154. </ItemGroup>{<ItemGroup>
  155.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  156.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  157. </ItemGroup><ItemGroup>
  158.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  159.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  160. </ItemGroup>if (string.IsNullOrEmpty(zip))<ItemGroup>
  161.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  162.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  163. </ItemGroup><ItemGroup>
  164.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  165.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  166. </ItemGroup>{<ItemGroup>
  167.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  168.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  169. </ItemGroup><ItemGroup>
  170.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  171.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  172. </ItemGroup><ItemGroup>
  173.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  174.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  175. </ItemGroup>return false;<ItemGroup>
  176.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  177.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  178. </ItemGroup><ItemGroup>
  179.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  180.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  181. </ItemGroup>}<ItemGroup>
  182.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  183.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  184. </ItemGroup><ItemGroup>
  185.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  186.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  187. </ItemGroup>var regex = new Regex(@"\d{6}");<ItemGroup>
  188.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  189.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  190. </ItemGroup><ItemGroup>
  191.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  192.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  193. </ItemGroup>return regex.IsMatch(zip);<ItemGroup>
  194.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  195.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  196. </ItemGroup>}}
复制代码
代码简单,使用到数字的大小和范围验证(见Age)、字符串不能为空和长度限制(见Name)、字符串正则表达式验证(见Zip)、多属性关联验证(最小值和最大值,这里配合属性set时通知其他属性验证通知RaisePropertyChanged(nameof(MaxValue));)。
4.3.2. FieldValidator

动态表单数据值校验器,同理需要继承AbstractValidator,泛型指定前面需要验证的实体类Field::
  1. public class FieldValidator : AbstractValidator{<ItemGroup>
  2.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  3.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  4. </ItemGroup>public FieldValidator()<ItemGroup>
  5.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  6.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  7. </ItemGroup>{<ItemGroup>
  8.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  9.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  10. </ItemGroup><ItemGroup>
  11.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  12.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  13. </ItemGroup>RuleFor(field => field.Value)<ItemGroup>
  14.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  15.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  16. </ItemGroup><ItemGroup>
  17.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  18.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  19. </ItemGroup><ItemGroup>
  20.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  21.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  22. </ItemGroup>.Must((field, value) => (field.Type == DataType.Text && !string.IsNullOrWhiteSpace(value))<ItemGroup>
  23.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  24.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  25. </ItemGroup><ItemGroup>
  26.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  27.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  28. </ItemGroup><ItemGroup>
  29.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  30.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  31. </ItemGroup><ItemGroup>
  32.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  33.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  34. </ItemGroup><ItemGroup>
  35.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  36.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  37. </ItemGroup><ItemGroup>
  38.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  39.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  40. </ItemGroup><ItemGroup>
  41.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  42.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  43. </ItemGroup><ItemGroup>
  44.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  45.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  46. </ItemGroup><ItemGroup>
  47.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  48.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  49. </ItemGroup>|| (field.Type == DataType.Number && double.TryParse(value, out _))<ItemGroup>
  50.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  51.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  52. </ItemGroup><ItemGroup>
  53.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  54.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  55. </ItemGroup><ItemGroup>
  56.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  57.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  58. </ItemGroup><ItemGroup>
  59.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  60.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  61. </ItemGroup><ItemGroup>
  62.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  63.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  64. </ItemGroup><ItemGroup>
  65.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  66.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  67. </ItemGroup><ItemGroup>
  68.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  69.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  70. </ItemGroup><ItemGroup>
  71.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  72.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  73. </ItemGroup><ItemGroup>
  74.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  75.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  76. </ItemGroup>|| (field.Type == DataType.Date && DateTime.TryParse(value, out _)))<ItemGroup>
  77.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  78.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  79. </ItemGroup><ItemGroup>
  80.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  81.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  82. </ItemGroup><ItemGroup>
  83.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  84.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  85. </ItemGroup>.WithMessage("1.文本不能为空;2.数字类型请填写数字;3.日志类型请填写日期类型");<ItemGroup>
  86.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  87.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  88. </ItemGroup>}}
复制代码
这里写的简单了点:

  • 文本数据类型,值不能为空;
  • 数字数据类型,必须是double类型;
  • 日期类型,必须能使用DateTime转换;
本文只做简单演示,多种数据类型放Must方法中做统一验证,验证出错给出统一的提示信息,读者可按实际情况修改。
4.3.3. StudentViewModelValidator

此外,我还创建了一个StudentViewModelValidator,用于验证ViewModel层的属性。这个验证器能够处理基本数据类型、对象属性以及集合属性的验证。
  1. public class StudentViewModelValidator : AbstractValidator{<ItemGroup>
  2.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  3.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  4. </ItemGroup>public StudentViewModelValidator()<ItemGroup>
  5.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  6.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  7. </ItemGroup>{<ItemGroup>
  8.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  9.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  10. </ItemGroup><ItemGroup>
  11.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  12.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  13. </ItemGroup>RuleFor(vm => vm.Title)<ItemGroup>
  14.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  15.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  16. </ItemGroup><ItemGroup>
  17.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  18.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  19. </ItemGroup><ItemGroup>
  20.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  21.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  22. </ItemGroup>.NotEmpty()<ItemGroup>
  23.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  24.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  25. </ItemGroup><ItemGroup>
  26.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  27.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  28. </ItemGroup><ItemGroup>
  29.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  30.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  31. </ItemGroup>.WithMessage("标题长度不能为空!")<ItemGroup>
  32.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  33.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  34. </ItemGroup><ItemGroup>
  35.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  36.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  37. </ItemGroup><ItemGroup>
  38.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  39.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  40. </ItemGroup>.Length(5, 30)<ItemGroup>
  41.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  42.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  43. </ItemGroup><ItemGroup>
  44.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  45.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  46. </ItemGroup><ItemGroup>
  47.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  48.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  49. </ItemGroup>.WithMessage("标题长度限制在5到30个字符之间!");<ItemGroup>
  50.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  51.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  52. </ItemGroup><ItemGroup>
  53.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  54.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  55. </ItemGroup>RuleFor(vm => vm.CurrentStudent).SetValidator(new StudentValidator());<ItemGroup>
  56.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  57.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  58. </ItemGroup><ItemGroup>
  59.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  60.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  61. </ItemGroup>RuleForEach(vm => vm.Fields).SetValidator(new FieldValidator());<ItemGroup>
  62.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  63.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  64. </ItemGroup>}}
复制代码

  • Title用于关联验证基本数据类型(string类型);
  • CurrentStudent用于验证对象属性(Student类的实例),设置验证该属性时使用StudentValidator验证器;
  • Fields用于验证集合属性(ObservableCollection),设置验证该属性子项时使用FieldValidator验证器,注意前面使用的RuleForEach表示关联集合中的项验证器。
4.4. ViewModel层实现

StudentViewModel与Student实体类结构类似,都需要实现IDataErrorInfo接口,该类由一个简单的string属性(Title)和一个复杂的Student对象属性(CurrentStudent)、集合属性ObservableCollection Fields组成,代码如下:
  1. /// ///<ItemGroup>
  2.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  3.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  4. </ItemGroup> 视图ViewModel///<ItemGroup>
  5.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  6.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  7. </ItemGroup> 继承BindableBase,即继承属性变化接口INotifyPropertyChanged///<ItemGroup>
  8.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  9.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  10. </ItemGroup> 实现IDataErrorInfo接口,用于FluentValidation验证,必须实现此接口/// public class StudentViewModel : BindableBase, IDataErrorInfo{<ItemGroup>
  11.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  12.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  13. </ItemGroup>private Student _currentStudent;<ItemGroup>
  14.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  15.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  16. </ItemGroup>private string _title;<ItemGroup>
  17.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  18.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  19. </ItemGroup>private readonly StudentViewModelValidator _validator;<ItemGroup>
  20.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  21.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  22. </ItemGroup>public string Title<ItemGroup>
  23.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  24.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  25. </ItemGroup>{<ItemGroup>
  26.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  27.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  28. </ItemGroup><ItemGroup>
  29.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  30.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  31. </ItemGroup>get => _title;<ItemGroup>
  32.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  33.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  34. </ItemGroup><ItemGroup>
  35.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  36.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  37. </ItemGroup>set => SetProperty(ref _title, value);<ItemGroup>
  38.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  39.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  40. </ItemGroup>}<ItemGroup>
  41.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  42.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  43. </ItemGroup>public Student CurrentStudent<ItemGroup>
  44.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  45.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  46. </ItemGroup>{<ItemGroup>
  47.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  48.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  49. </ItemGroup><ItemGroup>
  50.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  51.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  52. </ItemGroup>get => _currentStudent;<ItemGroup>
  53.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  54.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  55. </ItemGroup><ItemGroup>
  56.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  57.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  58. </ItemGroup>set => SetProperty(ref _currentStudent, value);<ItemGroup>
  59.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  60.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  61. </ItemGroup>}<ItemGroup>
  62.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  63.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  64. </ItemGroup>public ObservableCollection Fields { get; } = new();<ItemGroup>
  65.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  66.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  67. </ItemGroup>private DelegateCommand _saveCommand;<ItemGroup>
  68.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  69.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  70. </ItemGroup>public DelegateCommand SaveCommand => _saveCommand ??= new DelegateCommand(HandleSaveCommand,<ItemGroup>
  71.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  72.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  73. </ItemGroup><ItemGroup>
  74.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  75.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  76. </ItemGroup>HandleCanExecuteSaveCommand);<ItemGroup>
  77.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  78.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  79. </ItemGroup>private DelegateCommand _cancelCommand;<ItemGroup>
  80.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  81.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  82. </ItemGroup>public DelegateCommand CancelCommand =><ItemGroup>
  83.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  84.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  85. </ItemGroup><ItemGroup>
  86.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  87.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  88. </ItemGroup>_cancelCommand ??= new DelegateCommand(HandleCancelCommand, () => true);<ItemGroup>
  89.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  90.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  91. </ItemGroup>public StudentViewModel()<ItemGroup>
  92.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  93.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  94. </ItemGroup>{<ItemGroup>
  95.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  96.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  97. </ItemGroup><ItemGroup>
  98.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  99.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  100. </ItemGroup>_validator = new StudentViewModelValidator();<ItemGroup>
  101.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  102.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  103. </ItemGroup><ItemGroup>
  104.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  105.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  106. </ItemGroup>CurrentStudent = new Student<ItemGroup>
  107.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  108.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  109. </ItemGroup><ItemGroup>
  110.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  111.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  112. </ItemGroup>{<ItemGroup>
  113.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  114.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  115. </ItemGroup><ItemGroup>
  116.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  117.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  118. </ItemGroup><ItemGroup>
  119.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  120.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  121. </ItemGroup>Name = "李刚的儿",<ItemGroup>
  122.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  123.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  124. </ItemGroup><ItemGroup>
  125.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  126.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  127. </ItemGroup><ItemGroup>
  128.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  129.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  130. </ItemGroup>Age = 23<ItemGroup>
  131.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  132.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  133. </ItemGroup><ItemGroup>
  134.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  135.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  136. </ItemGroup>};<ItemGroup>
  137.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  138.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  139. </ItemGroup><ItemGroup>
  140.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  141.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  142. </ItemGroup>Fields.Add(new Field(DataType.Text, "文本,比如:四川省成都市场", "地址", ""));<ItemGroup>
  143.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  144.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  145. </ItemGroup><ItemGroup>
  146.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  147.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  148. </ItemGroup>Fields.Add(new Field(DataType.Number, "数字,比如:12", "工龄", ""));<ItemGroup>
  149.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  150.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  151. </ItemGroup><ItemGroup>
  152.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  153.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  154. </ItemGroup>Fields.Add(new Field(DataType.Date, "时间,比如:2023-09-26 05:13:23", "培训时间", ""));<ItemGroup>
  155.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  156.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  157. </ItemGroup><ItemGroup>
  158.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  159.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  160. </ItemGroup>PropertyChanged += Validate;<ItemGroup>
  161.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  162.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  163. </ItemGroup><ItemGroup>
  164.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  165.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  166. </ItemGroup>CurrentStudent.PropertyChanged += Validate;<ItemGroup>
  167.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  168.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  169. </ItemGroup><ItemGroup>
  170.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  171.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  172. </ItemGroup>foreach (var field in Fields)<ItemGroup>
  173.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  174.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  175. </ItemGroup><ItemGroup>
  176.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  177.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  178. </ItemGroup>{<ItemGroup>
  179.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  180.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  181. </ItemGroup><ItemGroup>
  182.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  183.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  184. </ItemGroup><ItemGroup>
  185.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  186.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  187. </ItemGroup>field.PropertyChanged += Validate;<ItemGroup>
  188.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  189.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  190. </ItemGroup><ItemGroup>
  191.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  192.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  193. </ItemGroup>}<ItemGroup>
  194.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  195.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  196. </ItemGroup>}<ItemGroup>
  197.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  198.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  199. </ItemGroup>~StudentViewModel()<ItemGroup>
  200.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  201.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  202. </ItemGroup>{<ItemGroup>
  203.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  204.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  205. </ItemGroup><ItemGroup>
  206.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  207.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  208. </ItemGroup>PropertyChanged -= Validate;<ItemGroup>
  209.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  210.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  211. </ItemGroup><ItemGroup>
  212.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  213.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  214. </ItemGroup>CurrentStudent.PropertyChanged -= Validate;<ItemGroup>
  215.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  216.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  217. </ItemGroup><ItemGroup>
  218.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  219.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  220. </ItemGroup>foreach (var field in Fields)<ItemGroup>
  221.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  222.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  223. </ItemGroup><ItemGroup>
  224.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  225.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  226. </ItemGroup>{<ItemGroup>
  227.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  228.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  229. </ItemGroup><ItemGroup>
  230.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  231.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  232. </ItemGroup><ItemGroup>
  233.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  234.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  235. </ItemGroup>field.PropertyChanged -= Validate;<ItemGroup>
  236.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  237.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  238. </ItemGroup><ItemGroup>
  239.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  240.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  241. </ItemGroup>}<ItemGroup>
  242.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  243.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  244. </ItemGroup>}<ItemGroup>
  245.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  246.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  247. </ItemGroup>private void Validate(object sender, PropertyChangedEventArgs e)<ItemGroup>
  248.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  249.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  250. </ItemGroup>{<ItemGroup>
  251.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  252.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  253. </ItemGroup><ItemGroup>
  254.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  255.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  256. </ItemGroup>_isCanExecuteSaveCommand = _validator.Validate(this).IsValid;<ItemGroup>
  257.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  258.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  259. </ItemGroup><ItemGroup>
  260.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  261.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  262. </ItemGroup>SaveCommand.RaiseCanExecuteChanged();<ItemGroup>
  263.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  264.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  265. </ItemGroup>}<ItemGroup>
  266.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  267.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  268. </ItemGroup>private void HandleSaveCommand()<ItemGroup>
  269.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  270.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  271. </ItemGroup>{<ItemGroup>
  272.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  273.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  274. </ItemGroup><ItemGroup>
  275.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  276.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  277. </ItemGroup>var validateResult = _validator.Validate(this);<ItemGroup>
  278.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  279.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  280. </ItemGroup><ItemGroup>
  281.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  282.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  283. </ItemGroup>if (validateResult.IsValid)<ItemGroup>
  284.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  285.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  286. </ItemGroup><ItemGroup>
  287.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  288.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  289. </ItemGroup>{<ItemGroup>
  290.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  291.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  292. </ItemGroup><ItemGroup>
  293.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  294.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  295. </ItemGroup><ItemGroup>
  296.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  297.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  298. </ItemGroup>MessageBox.Show("看到我说明验证成功!");<ItemGroup>
  299.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  300.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  301. </ItemGroup><ItemGroup>
  302.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  303.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  304. </ItemGroup>}<ItemGroup>
  305.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  306.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  307. </ItemGroup><ItemGroup>
  308.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  309.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  310. </ItemGroup>else<ItemGroup>
  311.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  312.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  313. </ItemGroup><ItemGroup>
  314.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  315.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  316. </ItemGroup>{<ItemGroup>
  317.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  318.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  319. </ItemGroup><ItemGroup>
  320.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  321.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  322. </ItemGroup><ItemGroup>
  323.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  324.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  325. </ItemGroup>var errorMsg = string.Join(Environment.NewLine,<ItemGroup>
  326.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  327.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  328. </ItemGroup><ItemGroup>
  329.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  330.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  331. </ItemGroup><ItemGroup>
  332.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  333.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  334. </ItemGroup><ItemGroup>
  335.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  336.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  337. </ItemGroup>validateResult.Errors.Select(x => x.ErrorMessage).ToArray());<ItemGroup>
  338.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  339.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  340. </ItemGroup><ItemGroup>
  341.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  342.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  343. </ItemGroup><ItemGroup>
  344.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  345.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  346. </ItemGroup>MessageBox.Show($"慌啥子嘛,你再检查下输入噻:\r\n{errorMsg}");<ItemGroup>
  347.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  348.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  349. </ItemGroup><ItemGroup>
  350.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  351.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  352. </ItemGroup>}<ItemGroup>
  353.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  354.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  355. </ItemGroup>}<ItemGroup>
  356.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  357.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  358. </ItemGroup>private bool _isCanExecuteSaveCommand;<ItemGroup>
  359.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  360.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  361. </ItemGroup>private bool HandleCanExecuteSaveCommand()<ItemGroup>
  362.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  363.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  364. </ItemGroup>{<ItemGroup>
  365.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  366.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  367. </ItemGroup><ItemGroup>
  368.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  369.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  370. </ItemGroup>return _isCanExecuteSaveCommand;<ItemGroup>
  371.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  372.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  373. </ItemGroup>}<ItemGroup>
  374.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  375.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  376. </ItemGroup>private void HandleCancelCommand()<ItemGroup>
  377.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  378.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  379. </ItemGroup>{<ItemGroup>
  380.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  381.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  382. </ItemGroup><ItemGroup>
  383.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  384.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  385. </ItemGroup>MessageBox.Show("我啥都不做,退休了");<ItemGroup>
  386.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  387.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  388. </ItemGroup>}<ItemGroup>
  389.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  390.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  391. </ItemGroup>public string this[string columnName]<ItemGroup>
  392.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  393.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  394. </ItemGroup>{<ItemGroup>
  395.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  396.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  397. </ItemGroup><ItemGroup>
  398.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  399.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  400. </ItemGroup>get<ItemGroup>
  401.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  402.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  403. </ItemGroup><ItemGroup>
  404.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  405.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  406. </ItemGroup>{<ItemGroup>
  407.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  408.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  409. </ItemGroup><ItemGroup>
  410.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  411.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  412. </ItemGroup><ItemGroup>
  413.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  414.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  415. </ItemGroup>var validateResult = _validator.Validate(this);<ItemGroup>
  416.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  417.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  418. </ItemGroup><ItemGroup>
  419.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  420.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  421. </ItemGroup><ItemGroup>
  422.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  423.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  424. </ItemGroup>if (validateResult.IsValid)<ItemGroup>
  425.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  426.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  427. </ItemGroup><ItemGroup>
  428.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  429.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  430. </ItemGroup><ItemGroup>
  431.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  432.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  433. </ItemGroup>{<ItemGroup>
  434.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  435.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  436. </ItemGroup><ItemGroup>
  437.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  438.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  439. </ItemGroup><ItemGroup>
  440.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  441.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  442. </ItemGroup><ItemGroup>
  443.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  444.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  445. </ItemGroup>return string.Empty;<ItemGroup>
  446.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  447.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  448. </ItemGroup><ItemGroup>
  449.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  450.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  451. </ItemGroup><ItemGroup>
  452.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  453.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  454. </ItemGroup>}<ItemGroup>
  455.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  456.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  457. </ItemGroup><ItemGroup>
  458.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  459.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  460. </ItemGroup><ItemGroup>
  461.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  462.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  463. </ItemGroup>var firstOrDefault =<ItemGroup>
  464.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  465.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  466. </ItemGroup><ItemGroup>
  467.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  468.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  469. </ItemGroup><ItemGroup>
  470.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  471.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  472. </ItemGroup><ItemGroup>
  473.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  474.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  475. </ItemGroup>validateResult.Errors.FirstOrDefault(error => error.PropertyName == columnName);<ItemGroup>
  476.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  477.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  478. </ItemGroup><ItemGroup>
  479.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  480.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  481. </ItemGroup><ItemGroup>
  482.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  483.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  484. </ItemGroup>return firstOrDefault == null ? string.Empty : firstOrDefault.ErrorMessage;<ItemGroup>
  485.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  486.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  487. </ItemGroup><ItemGroup>
  488.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  489.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  490. </ItemGroup>}<ItemGroup>
  491.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  492.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  493. </ItemGroup>}<ItemGroup>
  494.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  495.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  496. </ItemGroup>public string Error<ItemGroup>
  497.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  498.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  499. </ItemGroup>{<ItemGroup>
  500.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  501.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  502. </ItemGroup><ItemGroup>
  503.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  504.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  505. </ItemGroup>get<ItemGroup>
  506.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  507.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  508. </ItemGroup><ItemGroup>
  509.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  510.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  511. </ItemGroup>{<ItemGroup>
  512.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  513.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  514. </ItemGroup><ItemGroup>
  515.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  516.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  517. </ItemGroup><ItemGroup>
  518.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  519.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  520. </ItemGroup>var validateResult = _validator.Validate(this);<ItemGroup>
  521.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  522.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  523. </ItemGroup><ItemGroup>
  524.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  525.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  526. </ItemGroup><ItemGroup>
  527.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  528.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  529. </ItemGroup>if (validateResult.IsValid)<ItemGroup>
  530.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  531.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  532. </ItemGroup><ItemGroup>
  533.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  534.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  535. </ItemGroup><ItemGroup>
  536.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  537.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  538. </ItemGroup>{<ItemGroup>
  539.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  540.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  541. </ItemGroup><ItemGroup>
  542.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  543.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  544. </ItemGroup><ItemGroup>
  545.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  546.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  547. </ItemGroup><ItemGroup>
  548.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  549.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  550. </ItemGroup>return string.Empty;<ItemGroup>
  551.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  552.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  553. </ItemGroup><ItemGroup>
  554.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  555.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  556. </ItemGroup><ItemGroup>
  557.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  558.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  559. </ItemGroup>}<ItemGroup>
  560.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  561.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  562. </ItemGroup><ItemGroup>
  563.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  564.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  565. </ItemGroup><ItemGroup>
  566.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  567.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  568. </ItemGroup>var errors = string.Join(Environment.NewLine, validateResult.Errors.Select(x => x.ErrorMessage).ToArray());<ItemGroup>
  569.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  570.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  571. </ItemGroup><ItemGroup>
  572.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  573.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  574. </ItemGroup><ItemGroup>
  575.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  576.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  577. </ItemGroup>return errors;<ItemGroup>
  578.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  579.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  580. </ItemGroup><ItemGroup>
  581.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  582.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  583. </ItemGroup>}<ItemGroup>
  584.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  585.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  586. </ItemGroup>}}
复制代码
ViewModel属性验证和Student及Field类似,这里我加上了保存(SaveCommand)和取消(CancelCommand)两个命令,其中保存命令需要所有属性验证通过才可用,通过注册属性的变化事件PropertyChanged,在变化事件处理程序中验证:
  1. PropertyChanged += Validate;CurrentStudent.PropertyChanged += Validate;foreach (var field in Fields){<ItemGroup>
  2.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  3.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  4. </ItemGroup>field.PropertyChanged += Validate;}
复制代码
  1. private void Validate(object sender, PropertyChangedEventArgs e){<ItemGroup>
  2.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  3.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  4. </ItemGroup>_isCanExecuteSaveCommand = _validator.Validate(this).IsValid;<ItemGroup>
  5.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  6.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  7. </ItemGroup>SaveCommand.RaiseCanExecuteChanged();}
复制代码
4.5. 视图层实现

在视图层,我创建了一个用户控件StudentView,用于显示输入表单和验证结果。通过绑定ViewModel层的属性和命令,视图层能够与ViewModel层进行交互,并实时显示验证错误。这里比较简单,提供简单属性标题(Title)、复杂属性(包括学生姓名(CurrentStudent.Name)、学生年龄( CurrentStudent .Age)、学生邮政编码( CurrentStudent .Zip)、最小值(CurrentStudent.MinValue)、最大值(CurrentStudent.MaxValue))验证、集合属性验证(Fields),xaml代码如下:
  1. <ItemGroup>
  2.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  3.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  4. </ItemGroup><ItemGroup>
  5.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  6.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  7. </ItemGroup><ItemGroup>
  8.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  9.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  10. </ItemGroup><ItemGroup>
  11.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  12.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  13. </ItemGroup><ItemGroup>
  14.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  15.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  16. </ItemGroup><ItemGroup>
  17.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  18.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  19. </ItemGroup><ItemGroup>
  20.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  21.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  22. </ItemGroup><ItemGroup>
  23.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  24.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  25. </ItemGroup><ItemGroup>
  26.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  27.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  28. </ItemGroup><ItemGroup>
  29.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  30.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  31. </ItemGroup><ItemGroup>
  32.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  33.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  34. </ItemGroup><ItemGroup>
  35.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  36.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  37. </ItemGroup><ItemGroup>
  38.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  39.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  40. </ItemGroup><ItemGroup>
  41.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  42.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  43. </ItemGroup><ItemGroup>
  44.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  45.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  46. </ItemGroup><ItemGroup>
  47.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  48.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  49. </ItemGroup><ItemGroup>
  50.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  51.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  52. </ItemGroup><ItemGroup>
  53.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  54.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  55. </ItemGroup><ItemGroup>
  56.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  57.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  58. </ItemGroup><ItemGroup>
  59.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  60.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  61. </ItemGroup><ItemGroup>
  62.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  63.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  64. </ItemGroup><ItemGroup>
  65.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  66.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  67. </ItemGroup><ItemGroup>
  68.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  69.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  70. </ItemGroup><ItemGroup>
  71.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  72.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  73. </ItemGroup><ItemGroup>
  74.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  75.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  76. </ItemGroup><ItemGroup>
  77.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  78.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  79. </ItemGroup><ItemGroup>
  80.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  81.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  82. </ItemGroup><ItemGroup>
  83.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  84.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  85. </ItemGroup><ItemGroup>
  86.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  87.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  88. </ItemGroup><ItemGroup>
  89.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  90.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  91. </ItemGroup><ItemGroup>
  92.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  93.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  94. </ItemGroup><ItemGroup>
  95.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  96.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  97. </ItemGroup><ItemGroup>
  98.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  99.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  100. </ItemGroup><ItemGroup>
  101.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  102.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  103. </ItemGroup><ItemGroup>
  104.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  105.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  106. </ItemGroup><ItemGroup>
  107.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  108.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  109. </ItemGroup><ItemGroup>
  110.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  111.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  112. </ItemGroup><ItemGroup>
  113.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  114.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  115. </ItemGroup><ItemGroup>
  116.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  117.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  118. </ItemGroup><ItemGroup>
  119.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  120.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  121. </ItemGroup><ItemGroup>
  122.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  123.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  124. </ItemGroup><ItemGroup>
  125.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  126.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  127. </ItemGroup><ItemGroup>
  128.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  129.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  130. </ItemGroup><ItemGroup>
  131.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  132.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  133. </ItemGroup><ItemGroup>
  134.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  135.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  136. </ItemGroup><ItemGroup>
  137.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  138.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  139. </ItemGroup><ItemGroup>
  140.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  141.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  142. </ItemGroup><ItemGroup>
  143.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  144.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  145. </ItemGroup><ItemGroup>
  146.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  147.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  148. </ItemGroup><ItemGroup>
  149.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  150.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  151. </ItemGroup><ItemGroup>
  152.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  153.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  154. </ItemGroup><ItemGroup>
  155.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  156.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  157. </ItemGroup><ItemGroup>
  158.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  159.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  160. </ItemGroup><ItemGroup>
  161.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  162.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  163. </ItemGroup><ItemGroup>
  164.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  165.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  166. </ItemGroup><ItemGroup>
  167.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  168.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  169. </ItemGroup><ItemGroup>
  170.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  171.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  172. </ItemGroup><ItemGroup>
  173.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  174.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  175. </ItemGroup><ItemGroup>
  176.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  177.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  178. </ItemGroup><ItemGroup>
  179.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  180.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  181. </ItemGroup><ItemGroup>
  182.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  183.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  184. </ItemGroup><ItemGroup>
  185.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  186.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  187. </ItemGroup><ItemGroup>
  188.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  189.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  190. </ItemGroup><ItemGroup>
  191.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  192.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  193. </ItemGroup><ItemGroup>
  194.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  195.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  196. </ItemGroup><ItemGroup>
  197.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  198.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  199. </ItemGroup><ItemGroup>
  200.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  201.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  202. </ItemGroup><ItemGroup>
  203.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  204.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  205. </ItemGroup><ItemGroup>
  206.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  207.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  208. </ItemGroup><ItemGroup>
  209.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  210.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  211. </ItemGroup><ItemGroup>
  212.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  213.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  214. </ItemGroup><ItemGroup>
  215.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  216.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  217. </ItemGroup><ItemGroup>
  218.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  219.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  220. </ItemGroup><ItemGroup>
  221.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  222.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  223. </ItemGroup><ItemGroup>
  224.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  225.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  226. </ItemGroup><ItemGroup>
  227.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  228.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  229. </ItemGroup><ItemGroup>
  230.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  231.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  232. </ItemGroup><ItemGroup>
  233.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  234.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  235. </ItemGroup><ItemGroup>
  236.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  237.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  238. </ItemGroup><ItemGroup>
  239.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  240.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  241. </ItemGroup><ItemGroup>
  242.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  243.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  244. </ItemGroup><ItemGroup>
  245.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  246.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  247. </ItemGroup><ItemGroup>
  248.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  249.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  250. </ItemGroup><ItemGroup>
  251.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  252.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  253. </ItemGroup><ItemGroup>
  254.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  255.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  256. </ItemGroup><ItemGroup>
  257.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  258.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  259. </ItemGroup><ItemGroup>
  260.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  261.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  262. </ItemGroup><ItemGroup>
  263.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  264.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  265. </ItemGroup><ItemGroup>
  266.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  267.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  268. </ItemGroup><ItemGroup>
  269.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  270.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  271. </ItemGroup><ItemGroup>
  272.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  273.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  274. </ItemGroup><ItemGroup>
  275.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  276.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  277. </ItemGroup><ItemGroup>
  278.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  279.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  280. </ItemGroup><ItemGroup>
  281.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  282.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  283. </ItemGroup><ItemGroup>
  284.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  285.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  286. </ItemGroup><ItemGroup>
  287.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  288.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  289. </ItemGroup><ItemGroup>
  290.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  291.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  292. </ItemGroup><ItemGroup>
  293.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  294.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  295. </ItemGroup><ItemGroup>
  296.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  297.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  298. </ItemGroup><ItemGroup>
  299.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  300.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  301. </ItemGroup><ItemGroup>
  302.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  303.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  304. </ItemGroup><ItemGroup>
  305.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  306.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  307. </ItemGroup><ItemGroup>
  308.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  309.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  310. </ItemGroup><ItemGroup>
  311.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  312.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  313. </ItemGroup><ItemGroup>
  314.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  315.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  316. </ItemGroup><ItemGroup>
  317.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  318.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  319. </ItemGroup><ItemGroup>
  320.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  321.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  322. </ItemGroup><ItemGroup>
  323.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  324.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  325. </ItemGroup><ItemGroup>
  326.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  327.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  328. </ItemGroup><ItemGroup>
  329.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  330.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  331. </ItemGroup><ItemGroup>
  332.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  333.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  334. </ItemGroup><ItemGroup>
  335.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  336.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  337. </ItemGroup><ItemGroup>
  338.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  339.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  340. </ItemGroup><ItemGroup>
  341.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  342.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  343. </ItemGroup><ItemGroup>
  344.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  345.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  346. </ItemGroup><ItemGroup>
  347.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  348.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  349. </ItemGroup><ItemGroup>
  350.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  351.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  352. </ItemGroup><ItemGroup>
  353.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  354.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  355. </ItemGroup><ItemGroup>
  356.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  357.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  358. </ItemGroup><ItemGroup>
  359.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  360.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  361. </ItemGroup><ItemGroup>
  362.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  363.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  364. </ItemGroup><ItemGroup>
  365.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  366.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  367. </ItemGroup><ItemGroup>
  368.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  369.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  370. </ItemGroup><ItemGroup>
  371.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  372.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  373. </ItemGroup><ItemGroup>
  374.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  375.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  376. </ItemGroup><ItemGroup>
  377.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  378.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  379. </ItemGroup><ItemGroup>
  380.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  381.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  382. </ItemGroup><ItemGroup>
  383.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  384.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  385. </ItemGroup><ItemGroup>
  386.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  387.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  388. </ItemGroup><ItemGroup>
  389.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  390.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  391. </ItemGroup><ItemGroup>
  392.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  393.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  394. </ItemGroup><ItemGroup>
  395.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  396.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  397. </ItemGroup><ItemGroup>
  398.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  399.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  400. </ItemGroup><ItemGroup>
  401.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  402.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  403. </ItemGroup><ItemGroup>
  404.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  405.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  406. </ItemGroup><ItemGroup>
  407.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  408.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  409. </ItemGroup><ItemGroup>
  410.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  411.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  412. </ItemGroup><ItemGroup>
  413.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  414.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  415. </ItemGroup><ItemGroup>
  416.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  417.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  418. </ItemGroup><ItemGroup>
  419.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  420.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  421. </ItemGroup><ItemGroup>
  422.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  423.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  424. </ItemGroup><ItemGroup>
  425.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  426.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  427. </ItemGroup><ItemGroup>
  428.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  429.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  430. </ItemGroup><ItemGroup>
  431.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  432.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  433. </ItemGroup><ItemGroup>
  434.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  435.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  436. </ItemGroup><ItemGroup>
  437.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  438.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  439. </ItemGroup><ItemGroup>
  440.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  441.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  442. </ItemGroup><ItemGroup>
  443.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  444.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  445. </ItemGroup><ItemGroup>
  446.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  447.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  448. </ItemGroup><ItemGroup>
  449.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  450.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  451. </ItemGroup><ItemGroup>
  452.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  453.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  454. </ItemGroup><ItemGroup>
  455.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  456.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  457. </ItemGroup><ItemGroup>
  458.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  459.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  460. </ItemGroup><ItemGroup>
  461.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  462.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  463. </ItemGroup><ItemGroup>
  464.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  465.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  466. </ItemGroup><ItemGroup>
  467.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  468.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  469. </ItemGroup><ItemGroup>
  470.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  471.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  472. </ItemGroup><ItemGroup>
  473.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  474.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  475. </ItemGroup><ItemGroup>
  476.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  477.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  478. </ItemGroup><ItemGroup>
  479.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  480.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  481. </ItemGroup><ItemGroup>
  482.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  483.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  484. </ItemGroup><ItemGroup>
  485.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  486.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  487. </ItemGroup><ItemGroup>
  488.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  489.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  490. </ItemGroup><ItemGroup>
  491.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  492.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  493. </ItemGroup><ItemGroup>
  494.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  495.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  496. </ItemGroup><ItemGroup>
  497.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  498.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  499. </ItemGroup><ItemGroup>
  500.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  501.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  502. </ItemGroup><ItemGroup>
  503.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  504.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  505. </ItemGroup><ItemGroup>
  506.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  507.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  508. </ItemGroup><ItemGroup>
  509.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  510.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  511. </ItemGroup><ItemGroup>
  512.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  513.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  514. </ItemGroup><ItemGroup>
  515.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  516.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  517. </ItemGroup><ItemGroup>
  518.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  519.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  520. </ItemGroup><ItemGroup>
  521.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  522.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  523. </ItemGroup><ItemGroup>
  524.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  525.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  526. </ItemGroup><ItemGroup>
  527.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  528.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  529. </ItemGroup><ItemGroup>
  530.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  531.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  532. </ItemGroup><ItemGroup>
  533.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  534.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  535. </ItemGroup><ItemGroup>
  536.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  537.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  538. </ItemGroup><ItemGroup>
  539.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  540.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  541. </ItemGroup><ItemGroup>
  542.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  543.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  544. </ItemGroup><ItemGroup>
  545.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  546.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  547. </ItemGroup><ItemGroup>
  548.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  549.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  550. </ItemGroup><ItemGroup>
  551.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  552.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  553. </ItemGroup><ItemGroup>
  554.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  555.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  556. </ItemGroup><ItemGroup>
  557.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  558.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  559. </ItemGroup><ItemGroup>
  560.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  561.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  562. </ItemGroup><ItemGroup>
  563.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  564.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  565. </ItemGroup><ItemGroup>
  566.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  567.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  568. </ItemGroup><ItemGroup>
  569.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  570.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  571. </ItemGroup><ItemGroup>
  572.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  573.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  574. </ItemGroup><ItemGroup>
  575.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  576.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  577. </ItemGroup><ItemGroup>
  578.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  579.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  580. </ItemGroup><ItemGroup>
  581.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  582.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  583. </ItemGroup><ItemGroup>
  584.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  585.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  586. </ItemGroup><ItemGroup>
  587.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  588.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  589. </ItemGroup><ItemGroup>
  590.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  591.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  592. </ItemGroup><ItemGroup>
  593.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  594.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  595. </ItemGroup><ItemGroup>
  596.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  597.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  598. </ItemGroup><ItemGroup>
  599.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  600.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  601. </ItemGroup><ItemGroup>
  602.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  603.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  604. </ItemGroup><ItemGroup>
  605.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  606.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  607. </ItemGroup><ItemGroup>
  608.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  609.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  610. </ItemGroup><ItemGroup>
  611.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  612.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  613. </ItemGroup><ItemGroup>
  614.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  615.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  616. </ItemGroup><ItemGroup>
  617.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  618.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  619. </ItemGroup><ItemGroup>
  620.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  621.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  622. </ItemGroup><ItemGroup>
  623.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  624.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  625. </ItemGroup><ItemGroup>
  626.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  627.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  628. </ItemGroup><ItemGroup>
  629.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  630.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  631. </ItemGroup><ItemGroup>
  632.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  633.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  634. </ItemGroup><ItemGroup>
  635.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  636.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  637. </ItemGroup><ItemGroup>
  638.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  639.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  640. </ItemGroup><ItemGroup>
  641.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  642.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  643. </ItemGroup><ItemGroup>
  644.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  645.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  646. </ItemGroup><ItemGroup>
  647.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  648.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  649. </ItemGroup><ItemGroup>
  650.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  651.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  652. </ItemGroup><ItemGroup>
  653.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  654.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  655. </ItemGroup><ItemGroup>
  656.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  657.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  658. </ItemGroup><ItemGroup>
  659.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  660.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  661. </ItemGroup><ItemGroup>
  662.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  663.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  664. </ItemGroup><ItemGroup>
  665.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  666.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  667. </ItemGroup><ItemGroup>
  668.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  669.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  670. </ItemGroup><ItemGroup>
  671.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  672.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  673. </ItemGroup><ItemGroup>
  674.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  675.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  676. </ItemGroup><ItemGroup>
  677.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  678.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  679. </ItemGroup><ItemGroup>
  680.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  681.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  682. </ItemGroup><ItemGroup>
  683.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  684.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  685. </ItemGroup><ItemGroup>
  686.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  687.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  688. </ItemGroup><ItemGroup>
  689.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  690.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  691. </ItemGroup><ItemGroup>
  692.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  693.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  694. </ItemGroup><ItemGroup>
  695.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  696.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  697. </ItemGroup><ItemGroup>
  698.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  699.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  700. </ItemGroup><ItemGroup>
  701.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  702.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  703. </ItemGroup><ItemGroup>
  704.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  705.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  706. </ItemGroup><ItemGroup>
  707.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  708.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  709. </ItemGroup><ItemGroup>
  710.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  711.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  712. </ItemGroup><ItemGroup>
  713.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  714.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  715. </ItemGroup><ItemGroup>
  716.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  717.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  718. </ItemGroup><ItemGroup>
  719.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  720.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  721. </ItemGroup><ItemGroup>
  722.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  723.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  724. </ItemGroup><ItemGroup>
  725.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  726.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  727. </ItemGroup><ItemGroup>
  728.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  729.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  730. </ItemGroup><ItemGroup>
  731.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  732.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  733. </ItemGroup><ItemGroup>
  734.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  735.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  736. </ItemGroup><ItemGroup>
  737.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  738.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  739. </ItemGroup><ItemGroup>
  740.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  741.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  742. </ItemGroup><ItemGroup>
  743.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  744.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  745. </ItemGroup><ItemGroup>
  746.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  747.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  748. </ItemGroup><ItemGroup>
  749.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  750.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  751. </ItemGroup><ItemGroup>
  752.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  753.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  754. </ItemGroup><ItemGroup>
  755.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  756.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  757. </ItemGroup><ItemGroup>
  758.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  759.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  760. </ItemGroup><ItemGroup>
  761.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  762.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  763. </ItemGroup><ItemGroup>
  764.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  765.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  766. </ItemGroup><ItemGroup>
  767.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  768.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  769. </ItemGroup><ItemGroup>
  770.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  771.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  772. </ItemGroup><ItemGroup>
  773.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  774.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  775. </ItemGroup><ItemGroup>
  776.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  777.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  778. </ItemGroup><ItemGroup>
  779.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  780.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  781. </ItemGroup><ItemGroup>
  782.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  783.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  784. </ItemGroup><ItemGroup>
  785.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  786.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  787. </ItemGroup><ItemGroup>
  788.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  789.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  790. </ItemGroup><ItemGroup>
  791.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  792.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  793. </ItemGroup><ItemGroup>
  794.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  795.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  796. </ItemGroup><ItemGroup>
  797.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  798.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  799. </ItemGroup><ItemGroup>
  800.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  801.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  802. </ItemGroup><ItemGroup>
  803.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  804.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  805. </ItemGroup><ItemGroup>
  806.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  807.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  808. </ItemGroup><ItemGroup>
  809.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  810.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  811. </ItemGroup><ItemGroup>
  812.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  813.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  814. </ItemGroup><ItemGroup>
  815.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  816.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  817. </ItemGroup><ItemGroup>
  818.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  819.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  820. </ItemGroup><ItemGroup>
  821.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  822.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  823. </ItemGroup><ItemGroup>
  824.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  825.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  826. </ItemGroup><ItemGroup>
  827.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  828.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  829. </ItemGroup><ItemGroup>
  830.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  831.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  832. </ItemGroup><ItemGroup>
  833.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  834.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  835. </ItemGroup><ItemGroup>
  836.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  837.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  838. </ItemGroup><ItemGroup>
  839.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  840.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  841. </ItemGroup><ItemGroup>
  842.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  843.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  844. </ItemGroup><ItemGroup>
  845.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  846.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  847. </ItemGroup><ItemGroup>
  848.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  849.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  850. </ItemGroup><ItemGroup>
  851.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  852.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  853. </ItemGroup><ItemGroup>
  854.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  855.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  856. </ItemGroup><ItemGroup>
  857.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  858.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  859. </ItemGroup><ItemGroup>
  860.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  861.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  862. </ItemGroup><ItemGroup>
  863.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  864.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  865. </ItemGroup><ItemGroup>
  866.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  867.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  868. </ItemGroup><ItemGroup>
  869.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  870.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  871. </ItemGroup><ItemGroup>
  872.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  873.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  874. </ItemGroup><ItemGroup>
  875.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  876.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  877. </ItemGroup><ItemGroup>
  878.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  879.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  880. </ItemGroup><ItemGroup>
  881.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  882.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  883. </ItemGroup><ItemGroup>
  884.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  885.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  886. </ItemGroup><ItemGroup>
  887.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  888.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  889. </ItemGroup><ItemGroup>
  890.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  891.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  892. </ItemGroup><ItemGroup>
  893.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  894.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  895. </ItemGroup><ItemGroup>
  896.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  897.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  898. </ItemGroup><ItemGroup>
  899.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  900.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  901. </ItemGroup><ItemGroup>
  902.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  903.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  904. </ItemGroup><ItemGroup>
  905.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  906.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  907. </ItemGroup><ItemGroup>
  908.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  909.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  910. </ItemGroup><ItemGroup>
  911.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  912.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  913. </ItemGroup><ItemGroup>
  914.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  915.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  916. </ItemGroup><ItemGroup>
  917.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  918.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  919. </ItemGroup><ItemGroup>
  920.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  921.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  922. </ItemGroup><ItemGroup>
  923.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  924.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  925. </ItemGroup><ItemGroup>
  926.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  927.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  928. </ItemGroup><ItemGroup>
  929.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  930.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  931. </ItemGroup><ItemGroup>
  932.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  933.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  934. </ItemGroup><ItemGroup>
  935.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  936.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  937. </ItemGroup><ItemGroup>
  938.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  939.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  940. </ItemGroup><ItemGroup>
  941.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  942.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  943. </ItemGroup><ItemGroup>
  944.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  945.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  946. </ItemGroup><ItemGroup>
  947.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  948.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  949. </ItemGroup><ItemGroup>
  950.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  951.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  952. </ItemGroup><ItemGroup>
  953.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  954.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  955. </ItemGroup><ItemGroup>
  956.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  957.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  958. </ItemGroup><ItemGroup>
  959.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  960.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  961. </ItemGroup><ItemGroup>
  962.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  963.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  964. </ItemGroup><ItemGroup>
  965.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  966.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  967. </ItemGroup><ItemGroup>
  968.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  969.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  970. </ItemGroup><ItemGroup>
  971.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  972.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  973. </ItemGroup><ItemGroup>
  974.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  975.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  976. </ItemGroup><ItemGroup>
  977.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  978.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  979. </ItemGroup><ItemGroup>
  980.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  981.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  982. </ItemGroup><ItemGroup>
  983.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  984.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  985. </ItemGroup><ItemGroup>
  986.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  987.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  988. </ItemGroup><ItemGroup>
  989.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  990.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  991. </ItemGroup><ItemGroup>
  992.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  993.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  994. </ItemGroup><ItemGroup>
  995.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  996.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  997. </ItemGroup><ItemGroup>
  998.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  999.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1000. </ItemGroup><ItemGroup>
  1001.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1002.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1003. </ItemGroup><ItemGroup>
  1004.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1005.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1006. </ItemGroup><ItemGroup>
  1007.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1008.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1009. </ItemGroup><ItemGroup>
  1010.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1011.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1012. </ItemGroup><ItemGroup>
  1013.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1014.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1015. </ItemGroup><ItemGroup>
  1016.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1017.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1018. </ItemGroup><ItemGroup>
  1019.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1020.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1021. </ItemGroup><ItemGroup>
  1022.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1023.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1024. </ItemGroup><ItemGroup>
  1025.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1026.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1027. </ItemGroup><ItemGroup>
  1028.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1029.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1030. </ItemGroup><ItemGroup>
  1031.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1032.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1033. </ItemGroup><ItemGroup>
  1034.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1035.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1036. </ItemGroup><ItemGroup>
  1037.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1038.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1039. </ItemGroup><ItemGroup>
  1040.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1041.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1042. </ItemGroup><ItemGroup>
  1043.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1044.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1045. </ItemGroup><ItemGroup>
  1046.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1047.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1048. </ItemGroup><ItemGroup>
  1049.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1050.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1051. </ItemGroup><ItemGroup>
  1052.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1053.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1054. </ItemGroup><ItemGroup>
  1055.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1056.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1057. </ItemGroup><ItemGroup>
  1058.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1059.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1060. </ItemGroup><ItemGroup>
  1061.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1062.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1063. </ItemGroup><ItemGroup>
  1064.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1065.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1066. </ItemGroup><ItemGroup>
  1067.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1068.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1069. </ItemGroup><ItemGroup>
  1070.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1071.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1072. </ItemGroup><ItemGroup>
  1073.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1074.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1075. </ItemGroup><ItemGroup>
  1076.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1077.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1078. </ItemGroup><ItemGroup>
  1079.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1080.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1081. </ItemGroup><ItemGroup>
  1082.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1083.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1084. </ItemGroup><ItemGroup>
  1085.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1086.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1087. </ItemGroup><ItemGroup>
  1088.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1089.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1090. </ItemGroup><ItemGroup>
  1091.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1092.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1093. </ItemGroup><ItemGroup>
  1094.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1095.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1096. </ItemGroup><ItemGroup>
  1097.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1098.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1099. </ItemGroup><ItemGroup>
  1100.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1101.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1102. </ItemGroup><ItemGroup>
  1103.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1104.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1105. </ItemGroup><ItemGroup>
  1106.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1107.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1108. </ItemGroup><ItemGroup>
  1109.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1110.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1111. </ItemGroup><ItemGroup>
  1112.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1113.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1114. </ItemGroup><ItemGroup>
  1115.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1116.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1117. </ItemGroup><ItemGroup>
  1118.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1119.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1120. </ItemGroup><ItemGroup>
  1121.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1122.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1123. </ItemGroup><ItemGroup>
  1124.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1125.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1126. </ItemGroup><ItemGroup>
  1127.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1128.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1129. </ItemGroup><ItemGroup>
  1130.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1131.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1132. </ItemGroup><ItemGroup>
  1133.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1134.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1135. </ItemGroup><ItemGroup>
  1136.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1137.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1138. </ItemGroup><ItemGroup>
  1139.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1140.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1141. </ItemGroup><ItemGroup>
  1142.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1143.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1144. </ItemGroup><ItemGroup>
  1145.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1146.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1147. </ItemGroup><ItemGroup>
  1148.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1149.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1150. </ItemGroup><ItemGroup>
  1151.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1152.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1153. </ItemGroup><ItemGroup>
  1154.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1155.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1156. </ItemGroup><ItemGroup>
  1157.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1158.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1159. </ItemGroup><ItemGroup>
  1160.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1161.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1162. </ItemGroup><ItemGroup>
  1163.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1164.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1165. </ItemGroup><ItemGroup>
  1166.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1167.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1168. </ItemGroup><ItemGroup>
  1169.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1170.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1171. </ItemGroup><ItemGroup>
  1172.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1173.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1174. </ItemGroup><ItemGroup>
  1175.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1176.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1177. </ItemGroup><ItemGroup>
  1178.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1179.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1180. </ItemGroup><ItemGroup>
  1181.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1182.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1183. </ItemGroup><ItemGroup>
  1184.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1185.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1186. </ItemGroup><ItemGroup>
  1187.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1188.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1189. </ItemGroup><ItemGroup>
  1190.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1191.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1192. </ItemGroup><ItemGroup>
  1193.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1194.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1195. </ItemGroup><ItemGroup>
  1196.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1197.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1198. </ItemGroup><ItemGroup>
  1199.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1200.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1201. </ItemGroup><ItemGroup>
  1202.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1203.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1204. </ItemGroup><ItemGroup>
  1205.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1206.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1207. </ItemGroup><ItemGroup>
  1208.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1209.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1210. </ItemGroup><ItemGroup>
  1211.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1212.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1213. </ItemGroup><ItemGroup>
  1214.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1215.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1216. </ItemGroup><ItemGroup>
  1217.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1218.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1219. </ItemGroup><ItemGroup>
  1220.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1221.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1222. </ItemGroup><ItemGroup>
  1223.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1224.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1225. </ItemGroup><ItemGroup>
  1226.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1227.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1228. </ItemGroup><ItemGroup>
  1229.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1230.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1231. </ItemGroup><ItemGroup>
  1232.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1233.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1234. </ItemGroup><ItemGroup>
  1235.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1236.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1237. </ItemGroup><ItemGroup>
  1238.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1239.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1240. </ItemGroup><ItemGroup>
  1241.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1242.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1243. </ItemGroup><ItemGroup>
  1244.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1245.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1246. </ItemGroup><ItemGroup>
  1247.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1248.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1249. </ItemGroup><ItemGroup>
  1250.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1251.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1252. </ItemGroup><ItemGroup>
  1253.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1254.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1255. </ItemGroup><ItemGroup>
  1256.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1257.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1258. </ItemGroup><ItemGroup>
  1259.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1260.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1261. </ItemGroup><ItemGroup>
  1262.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1263.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1264. </ItemGroup><ItemGroup>
  1265.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1266.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1267. </ItemGroup><ItemGroup>
  1268.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1269.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1270. </ItemGroup><ItemGroup>
  1271.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1272.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1273. </ItemGroup><ItemGroup>
  1274.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1275.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1276. </ItemGroup><ItemGroup>
  1277.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1278.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1279. </ItemGroup><ItemGroup>
  1280.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1281.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1282. </ItemGroup><ItemGroup>
  1283.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1284.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1285. </ItemGroup><ItemGroup>
  1286.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1287.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1288. </ItemGroup><ItemGroup>
  1289.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1290.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1291. </ItemGroup><ItemGroup>
  1292.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  1293.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  1294. </ItemGroup>
复制代码
4.6. 错误提示样式

为了提升用户体验,我定义了两种错误提示样式:一种是通过红色图标提示输入框旁边的错误,另一种是在输入框右侧显示错误文字。这些样式定义在App.xaml中,并可以在整个应用程序中复用。
  1. <ItemGroup>
  2.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  3.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  4. </ItemGroup><ItemGroup>
  5.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  6.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  7. </ItemGroup><ItemGroup>
  8.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  9.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  10. </ItemGroup><ItemGroup>
  11.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  12.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  13. </ItemGroup><ItemGroup>
  14.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  15.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  16. </ItemGroup><ItemGroup>
  17.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  18.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  19. </ItemGroup><ItemGroup>
  20.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  21.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  22. </ItemGroup><ItemGroup>
  23.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  24.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  25. </ItemGroup><ItemGroup>
  26.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  27.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  28. </ItemGroup><ItemGroup>
  29.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  30.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  31. </ItemGroup><ItemGroup>
  32.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  33.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  34. </ItemGroup><ItemGroup>
  35.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  36.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  37. </ItemGroup><ItemGroup>
  38.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  39.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  40. </ItemGroup><ItemGroup>
  41.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  42.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  43. </ItemGroup><ItemGroup>
  44.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  45.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  46. </ItemGroup><ItemGroup>
  47.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  48.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  49. </ItemGroup><ItemGroup>
  50.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  51.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  52. </ItemGroup><ItemGroup>
  53.   <PackageReference Include="FluentValidation" Version="11.9.0" />
  54.   <PackageReference Include="Prism.Wpf" Version="9.0.271-pre" />
  55. </ItemGroup>
复制代码
5. 效果展示

通过上述步骤的实现,我们得到了一个功能完善的WPF应用程序。它能够根据用户输入实时进行验证,并提供直观的错误提示。当所有属性都验证通过时,提交按钮将变为可用状态。

6. 源码分享

为了方便读者学习和交流,本文将所有代码同步到了Gitee和Github平台上。欢迎感兴趣的开发者访问以下链接获取源码:
7. 总结

通过本文的介绍和实践,我们成功将FluentValidation应用于C# WPF项目中,实现了对ViewModel层属性的全面验证。这不仅提升了数据的安全性和准确性,也为用户提供了更好的交互体验。希望本文能对广大开发者在WPF项目中使用FluentValidation提供有益的参考和启示。
参考:

来源:https://www.cnblogs.com/Dotnet9-com/p/17986383
免责声明:由于采集信息均来自互联网,如果侵犯了您的权益,请联系我们【E-Mail:cb@itdo.tech】 我们会及时删除侵权内容,谢谢合作!

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x

举报 回复 使用道具