{"id":350541,"date":"2023-07-20T09:02:08","date_gmt":"2023-07-20T09:02:08","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=350541"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=350541","title":{"rendered":"<span>ReactiveValidation 2.0: \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 Avalonia \u0438 WPF<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442!<\/p>\n<p>5 \u043b\u0435\u0442 \u043d\u0430\u0437\u0430\u0434 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043b, \u043a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043b <a href=\"https:\/\/habr.com\/ru\/articles\/354886\/\" rel=\"noopener noreferrer nofollow\">\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0434\u043b\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 WPF<\/a>. \u0412\u0441\u0451 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u043b\u0441\u044f \u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u0442 \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u0440\u0443\u0433\u043e\u0439 \u0434\u0435\u0441\u043a\u0442\u043e\u043f \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a &#8212; <a href=\"https:\/\/avaloniaui.net\/\" rel=\"noopener noreferrer nofollow\">Avalonia UI<\/a>. \u041c\u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0442\u0430\u043a\u0436\u0435 \u0438 \u0435\u0433\u043e, \u0447\u0442\u043e \u0438 \u0431\u044b\u043b\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438. \u041f\u043e\u043c\u0438\u043c\u043e \u044d\u0442\u043e\u0433\u043e, \u0442\u0443\u0434\u0430 \u0432\u043e\u0448\u043b\u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u0444\u0438\u0447\u0438.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u0431\u044b\u043b\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u0435\u0440\u0435\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e (\u0442\u0435\u043c \u0431\u043e\u043b\u0435\u0435, \u043c\u043d\u043e\u0433\u043e\u0435 \u043f\u043e\u043c\u0435\u043d\u044f\u043b\u043e\u0441\u044c \u0441 \u0442\u0435\u0445 \u043f\u043e\u0440), \u0437\u0434\u0435\u0441\u044c \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0441\u0451, \u0447\u0442\u043e \u0443\u043c\u0435\u0435\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/5fd\/ba0\/d3d\/5fdba0d3d411338c2071397f3193dad9.png\" alt=\"FluentTheme \u043e\u0442 Avalonia \u0441 \u0440\u0430\u0437\u043d\u043e\u0433\u043e \u0440\u043e\u0434\u0430 \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438\" title=\"FluentTheme \u043e\u0442 Avalonia \u0441 \u0440\u0430\u0437\u043d\u043e\u0433\u043e \u0440\u043e\u0434\u0430 \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438\" width=\"701\" height=\"435\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5fd\/ba0\/d3d\/5fdba0d3d411338c2071397f3193dad9.png\"\/><\/p>\n<div><figcaption>FluentTheme \u043e\u0442 Avalonia \u0441 \u0440\u0430\u0437\u043d\u043e\u0433\u043e \u0440\u043e\u0434\u0430 \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438<\/figcaption><\/div>\n<\/figure>\n<blockquote>\n<p>\u041d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0441 \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u0432\u044b\u0445\u043e\u0434\u0430 \u043f\u0435\u0440\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043e\u0442 ReactiveUI &#8212;  <a href=\"https:\/\/github.com\/reactiveui\/ReactiveUI.Validation\" rel=\"noopener noreferrer nofollow\">ReactiveUI.Validation<\/a>. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 <code>ReactiveValidation<\/code> \u0442\u0430\u043a\u0436\u0435 \u0431\u0443\u0434\u0443\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044e.<\/p>\n<\/blockquote>\n<h2>\u0417\u0430\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u0430\u0432\u0438\u043b<\/h2>\n<p>\u041f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u043b\u0430 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 <a href=\"https:\/\/github.com\/FluentValidation\/FluentValidation\" rel=\"noopener noreferrer nofollow\">FluentValidation<\/a>, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d\u0430 \u0438\u043c\u0435\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u0438 \u043b\u0435\u0433\u043a\u043e \u0447\u0438\u0442\u0430\u0435\u043c\u044b\u0439 fluent-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u043e\u0439\u043a\u0438 \u043f\u0440\u0430\u0432\u0438\u043b. \u042d\u0442\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u0440\u0430\u0437\u043e\u0432\u043e\u0439 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e web-\u0437\u0430\u043f\u0440\u043e\u0441\u0430), \u043d\u043e \u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f (\u043a\u0430\u043a \u044d\u0442\u043e \u0447\u0430\u0441\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u0434\u0435\u0441\u043a\u0442\u043e\u043f\u0435).<\/p>\n<p>\u041f\u043e \u044d\u0442\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u0432\u0441\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u0434\u043b\u044f <code>ReactiveValidation<\/code> \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u0441 \u043d\u0443\u043b\u044f. \u041e\u043d\u0430 \u0441\u0440\u0430\u0437\u0443 \u0437\u0430\u0432\u044f\u0437\u0430\u043d\u0430 \u043d\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0435 <a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/system.componentmodel.inotifypropertychanged?view=net-7.0\" rel=\"noopener noreferrer nofollow\">INotifyPropertyChanged<\/a> \u0438 <a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/system.componentmodel.inotifydataerrorinfo?view=net-7.0\" rel=\"noopener noreferrer nofollow\">INotifyDataErrorInfo<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043a\u0430\u043a \u0432 WPF, \u0442\u0430\u043a \u0438 \u0432 Avalonia, \u0447\u0442\u043e\u0431\u044b \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 UI. \u041d\u043e \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0432\u043e \u043c\u043d\u043e\u0433\u043e\u043c \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442 <code>FluentValidation<\/code>:<\/p>\n<pre><code class=\"cs\">builder.RuleFor(vm => vm.PhoneNumber)     .NotEmpty()         .When(vm => Email, email => string.IsNullOrEmpty(email))         .WithMessage(\"You need to specify a phone or email\")     .Matches(@\"^\\d{11}$\")         .WithMessage(\"Phone number must contain 11 digits\");  builder.RuleFor(vm => vm.Email)     .NotEmpty()         .When(vm => PhoneNumber, phoneNumber => string.IsNullOrEmpty(phoneNumber))         .WithMessage(\"You need to specify a phone or email\")     .Must(IsValidEmail)         .WithMessage(\"Not valid email\");   builder.RuleFor(vm => vm.Password)     .NotEmpty()     .MinLength(8, ValidationMessageType.Warning)         .WithMessage(\"For a secure password, enter more than {MinLength} characters. You entered {TotalLength} characters\");  builder.RuleFor(vm => vm.ConfirmPassword)     .Equal(vm => vm.Password);   builder.RuleFor(vm => vm.Country)     .NotEmpty()     .AllWhen(vm => vm.AdditionalInformation);  builder.RuleFor(vm => vm.City)     .NotEmpty()     .AllWhen(vm => vm.AdditionalInformation);<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435, \u043a\u0430\u043a \u0438 \u0434\u043b\u044f <code>FluentValidation<\/code>, \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>NotEmpty<\/code>, <code>Matches<\/code>, <code>MinLength<\/code>, <code>Must<\/code>). \u0415\u0441\u043b\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u043e\u0441\u043e\u0431\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u0445, \u0442\u043e \u0435\u0441\u0442\u044c <code>When<\/code>. \u0427\u0442\u043e\u0431\u044b \u0437\u0430\u0434\u0430\u0442\u044c \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0434\u043b\u044f \u0432\u0441\u0435\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u043f\u0440\u0430\u0432\u0438\u043b, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>AllWhen<\/code>. \u0414\u043b\u044f \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0442\u0435\u043a\u0441\u0442\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>WithMessage<\/code> \/ <code>WithLocalizedMessage<\/code>. \u0427\u0442\u043e\u0431\u044b \u0437\u0430\u0434\u0430\u0442\u044c \u0432\u0430\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <code>ValidationMessageType<\/code> (\u0447\u0442\u043e\u0431\u044b <code>Warning<\/code> \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u043b\u0441\u044f \u043e\u0440\u0430\u043d\u0436\u0435\u0432\u044b\u043c \u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d\u044b, \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0432 \u0441\u0430\u043c\u043e\u043c \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438).<\/p>\n<blockquote>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0432\u0430\u0436\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442. \u0415\u0441\u043b\u0438 \u0432 \u043f\u0440\u0430\u0432\u0438\u043b\u0435 \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u0442\u043e \u0435\u0433\u043e \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043a\u0430\u043a \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0441 <code>When(vm => Email, email => string.IsNullOrEmpty(email))<\/code>. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440 \u0431\u0443\u0434\u0435\u0442 \u0437\u043d\u0430\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u0443 \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d\u043e \u0434\u0432\u0430 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 (<code>PhoneNumber<\/code> \u0438 <code>Email<\/code> ), \u0438 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0435\u0433\u043e \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u043b\u044e\u0431\u043e\u0433\u043e \u0438\u0437 \u043d\u0438\u0445.<\/p>\n<\/blockquote>\n<h2>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440\u0430 \u0434\u043b\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430<\/h2>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u043b\u0438\u0441\u044c \u0434\u043b\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e:<\/p>\n<ol>\n<li>\n<p>\u0423\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u0432\u0430\u043b\u0438\u0434\u0438\u0440\u0443\u0435\u043c\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u043e\u0442 <code>ValidatableObject<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <code>Validator<\/code>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f <code>ValidationBuilder&lt;T><\/code>.<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"cs\">public class BaseSampleViewModel : ValidatableObject {     public BaseSampleViewModel()     {         Validator = GetValidator();     }      private IObjectValidator GetValidator()     {         var builder = new ValidationBuilder&lt;BaseSampleViewModel>();         \/\/ \u0417\u0434\u0435\u0441\u044c \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u0430.                             return builder.Build(this);     }      \/\/ \u0421\u0432\u043e\u0439\u0441\u0442\u0432\u0430 BaseSampleViewModel \u0441 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 INotifyPropertyChanged. }<\/code><\/pre>\n<blockquote>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 WPF, \u0442\u043e \u0432\u043e View \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 <code>AdornerDecorator<\/code> (<a href=\"https:\/\/github.com\/Karnah\/ReactiveValidation\/wiki\/WPF.-Quick-start#step-4-configure-your-view\" rel=\"noopener noreferrer nofollow\">\u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u0442\u0443\u0442<\/a>). \u0412 Avalonia \u0432\u0441\u0451 \u0443\u0436\u0435 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043e \u0432 \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0441\u0442\u0438\u043b\u0438, \u0438 \u043d\u0438\u0447\u0435\u0433\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430 \u043d\u0430\u0434\u043e (\u0437\u0430 \u0447\u0442\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u043e\u043a\u043b\u043e\u043d \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c).<\/p>\n<\/blockquote>\n<blockquote>\n<p>\u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441, \u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <code>IValidatableObject<\/code>. \u0421\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e, <a href=\"https:\/\/github.com\/Karnah\/ReactiveValidation\/wiki\/Inheriting-your-class-from-IValidatableObject\" rel=\"noopener noreferrer nofollow\">\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0437\u0434\u0435\u0441\u044c<\/a>. <\/p>\n<\/blockquote>\n<p>\u0411\u043e\u043b\u044c\u0448\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u0412\u043d\u0443\u0442\u0440\u0438 <code>ValidatableObject<\/code> \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0432\u0441\u044f \u043b\u043e\u0433\u0438\u043a\u0430, \u0447\u0442\u043e\u0431\u044b View \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0430\u0445. \u041f\u043e\u043b\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 ViewModel \u043c\u043e\u0436\u043d\u043e <a href=\"https:\/\/github.com\/Karnah\/ReactiveValidation\/blob\/master\/src\/ReactiveValidation.Avalonia.Samples\/1.%20BaseSample\/BaseSampleViewModel.cs\" rel=\"noopener noreferrer nofollow\">\u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0437\u0434\u0435\u0441\u044c<\/a>. <\/p>\n<p>\u0412 \u043d\u043e\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 <code>ReactiveValidation<\/code> \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0441\u044f \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u0439 \u0434\u043b\u044f <code>FluentValidation<\/code> \u0441\u043f\u043e\u0441\u043e\u0431 \u0437\u0430\u0434\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435:<\/p>\n<pre><code class=\"cs\">public class YourViewModelValidation : ValidationRuleBuilder&lt;YourViewModel> {     public YourViewModelValidation()     {         RuleFor(vm => vm.Name)             .NotEmpty()             .MaxLength(16)             .NotEqual(\"foo\");          RuleFor(vm => vm.Surname)             .Equal(\"foo\");          RuleFor(vm => vm.PhoneNumber)             .NotEmpty(ValidationMessageType.Warning)             .Matches(@\"^\\d{9,12}$\");     } }<\/code><\/pre>\n<p>\u0422\u043e\u0433\u0434\u0430 \u0441\u0430\u043c \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438:<\/p>\n<pre><code class=\"cs\">\/\/ \u042d\u0442\u043e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 YourViewModel. public YourViewModel(IValidatorFactory validatorFactory) {     \/\/ \u041f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441\u0430.     Validator = new YourViewModelValidation().Build(this);      \/\/ \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0431\u0440\u0438\u043a\u0443-\u0441\u0438\u043d\u0433\u043b\u0442\u043e\u043d.     Validator = ValidationOptions.ValidatorFactory.GetValidator(this);      \/\/ \u0417\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0431\u0440\u0438\u043a\u0443 \u0432 DI \u0438 \u043f\u0440\u043e\u043a\u0438\u0434\u044b\u0432\u0430\u0442\u044c \u0435\u0451 \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440.     Validator = validatorFactory.GetValidator(this); }<\/code><\/pre>\n<p>\u041f\u0440\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044e \u0444\u0430\u0431\u0440\u0438\u043a\u0438 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043c\u043e\u0436\u043d\u043e <a href=\"https:\/\/github.com\/Karnah\/ReactiveValidation\/wiki\/Separate-validation-classes-and-validator-factory\" rel=\"noopener noreferrer nofollow\">\u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0442\u0443\u0442<\/a>.<\/p>\n<h2>\u041f\u0440\u0430\u0432\u0438\u043b\u0430 \u0434\u043b\u044f \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432<\/h2>\n<p>\u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0448\u0435\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435:<\/p>\n<ul>\n<li>\n<p>\u0441\u0430\u043c\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0442 <code>INotifyDataErrorInfo<\/code> \u0438\u043b\u0438 <code>IValidatableObject<\/code><\/p>\n<\/li>\n<li>\n<p>\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f\u043c\u0438, \u0430 \u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0442<code>INotifyDataErrorInfo<\/code> \u0438\u043b\u0438 <code>IValidatableObject<\/code>,<\/p>\n<\/li>\n<\/ul>\n<p>\u0442\u043e\u0433\u0434\u0430 \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u0434\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u043f\u0440\u043e\u0449\u0430\u044e\u0442 \u0440\u0430\u0431\u043e\u0442\u0443.<\/p>\n<pre><code class=\"cs\">builder.RuleFor(vm => vm.InnerObjectValue)     .SetValueValidator(GetInnerObjectValidator)     .NotNull()     .ModelIsValid();  builder.RuleForCollection(vm => vm.InnerObjectsCollection)     .SetCollectionItemValidator(GetInnerObjectValidator)     .NotNull()     .Count(3, 5)     .CollectionElementsAreValid();<\/code><\/pre>\n<p>\u0420\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u043f\u043e \u0432\u044b\u0437\u043e\u0432\u0430\u043c:<\/p>\n<ol>\n<li>\n<p><code>SetValueValidator(GetInnerObjectValidator)<\/code>, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 <code>InnerObjectValue<\/code> \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0441\u044f \u043e\u0442 <code>IValidatableObject<\/code>. \u0414\u043b\u044f \u043b\u044e\u0431\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d \u0432 <code>InnerObjectValue<\/code>, \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 <code>GetInnerObjectValidator<\/code> (\u043c\u0435\u0442\u043e\u0434 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0435 \u0432\u044b &#8212; \u043c\u043e\u0436\u043d\u043e \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440 \u0432\u0440\u0443\u0447\u043d\u0443\u044e, \u0442\u0430\u043a \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0431\u0440\u0438\u043a\u0443).<\/p>\n<\/li>\n<li>\n<p><code>ModelIsValid()<\/code> , \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438  <code>InnerObjectValue<\/code>  \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0441\u044f \u043e\u0442  <code>INotifyDataErrorInfo<\/code>. \u0415\u0441\u043b\u0438 \u043e\u0431\u044a\u0435\u043a\u0442<code>InnerObjectValue<\/code> \u043d\u0435 \u0432\u0430\u043b\u0438\u0434\u0435\u043d, \u0442\u043e \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0442\u0430\u043a\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435 \u0432\u0430\u043b\u0438\u0434\u0435\u043d.<\/p>\n<\/li>\n<li>\n<p><code>SetCollectionItemValidator(GetInnerObjectValidator)<\/code>, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u044e\u0442\u0441\u044f \u043e\u0442 <code>IValidatableObject<\/code>. \u041f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u0441 \u043f. 1 &#8212; \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440. \u0415\u0441\u043b\u0438 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442 <a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/system.collections.specialized.inotifycollectionchanged?view=net-7.0\" rel=\"noopener noreferrer nofollow\">INotifyCollectionChanged<\/a>, \u0442\u043e \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440\u044b \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0445 \u0432 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p><code>CollectionElementsAreValid()<\/code>, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u044e\u0442\u0441\u044f \u043e\u0442 <code>INotifyDataErrorInfo<\/code>. \u0427\u0442\u043e\u0431\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0440\u044b\u0445 &#8212; \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u0441 <code>INotifyCollectionChanged<\/code>, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/system.collections.objectmodel.observablecollection-1?view=net-7.0\" rel=\"noopener noreferrer nofollow\">ObservableCollection&lt;T><\/a>.<\/p>\n<\/li>\n<\/ol>\n<h2>\u041a\u0430\u0441\u043a\u0430\u0434\u043d\u044b\u0439 \u0440\u0435\u0436\u0438\u043c<\/h2>\n<p>\u0422\u043e\u0436\u0435 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u0430\u044f \u0434\u043b\u044f <code>FluentValidation<\/code> \u0432\u0435\u0449\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0432 \u043d\u043e\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 <code>ReactiveValidation<\/code>. \u0415\u0441\u043b\u0438 \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0437\u0430\u0434\u0430\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0430\u0432\u0438\u043b, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0440\u0435\u0436\u0438\u043c \u0438\u0445 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438:<\/p>\n<ol>\n<li>\n<p><code>CascadeMode.Continue<\/code> (\u0440\u0435\u0436\u0438\u043c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e) &#8212; \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442\u0441\u044f \u0432\u0441\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0434\u043b\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430. \u041d\u0430 \u044d\u043a\u0440\u0430\u043d \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u0435\u0441\u044c \u0441\u043f\u0438\u0441\u043e\u043a.<\/p>\n<\/li>\n<li>\n<p><code>CascadeMode.Stop<\/code> &#8212; \u0435\u0441\u043b\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0432\u0435\u0440\u043d\u0443\u043b\u043e \u043e\u0448\u0438\u0431\u043a\u0443, \u0442\u043e \u0432\u0441\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u044e\u0442\u0441\u044f.<\/p>\n<\/li>\n<\/ol>\n<p>\u0420\u0435\u0436\u0438\u043c \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c:<\/p>\n<ol>\n<li>\n<p>\u0414\u043b\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"cs\">builder.RuleFor(vm => vm.Email)     .WithPropertyCascadeMode(CascadeMode.Stop)     .NotEmpty().When(vm => vm.PhoneNumber, phoneNumber => string.IsNullOrEmpty(phoneNumber))     .Must(IsValidEmail);<\/code><\/pre>\n<ol start=\"2\">\n<li>\n<p>\u0414\u043b\u044f \u0431\u0438\u043b\u0434\u0435\u0440\u0430:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"cs\">builder.PropertyCascadeMode = CascadeMode.Stop;  \/\/ \u0418\u043b\u0438, \u0435\u0441\u043b\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0437\u0430\u0434\u0430\u044e\u0442\u0441\u044f \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435. PropertyCascadeMode = CascadeMode.Stop;<\/code><\/pre>\n<ol start=\"3\">\n<li>\n<p>\u0413\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"cs\">ValidationOptions     .Setup()     .UsePropertyCascadeMode(CascadeMode.Stop);<\/code><\/pre>\n<h2>\u0422\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0442\u0438\u043f\u043e\u0432 \u0441\u0432\u043e\u0439\u0441\u0442\u0432<\/h2>\n<p>\u041d\u0435\u0440\u0435\u0434\u043a\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f, \u043a\u043e\u0433\u0434\u0430 \u0447\u0438\u0441\u043b\u043e \u0432\u043e ViewModel \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u043a <code>string<\/code> \u0438 \u043f\u0440\u0438\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a <code>TextBox<\/code>. \u041d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0432\u0430\u043b\u0438\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u043a\u0430\u043a \u0447\u0438\u0441\u043b\u043e \u0438, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043d\u0430\u0432\u0435\u0441\u0438\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 <code>Transform<\/code>:<\/p>\n<pre><code class=\"cs\">builder     .TransformToInt(vm => vm.AgeString)     .NotNull().WithMessage(\"Age should be valid integer string\")     .Between(18, 35);<\/code><\/pre>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438:<\/p>\n<ol>\n<li>\n<p>\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0438\u0437 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 short, ushort, int, uint, long, ulong, float, double, decimal.<\/p>\n<\/li>\n<li>\n<p>\u041c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438:<code>Func&lt;TObject, TProp, TPropTransformed> transformer<\/code>\u00a0\u0438\u043b\u0438<code>Func&lt;TProp, TPropTransformed> transformer<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u041c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0432 \u043e\u0442 <code>ReactiveValidation.Validators.PropertyValueTransformers.IValueTransformer&lt;in TObject, out TTo><\/code>.<\/p>\n<\/li>\n<\/ol>\n<h2>\u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u0430\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f<\/h2>\n<p>\u0412 \u043d\u043e\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430. \u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u044d\u0442\u043e \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cs\">builder.RuleFor(vm => vm.Email)     .NotEmpty().When(vm => vm.PhoneNumber, phoneNumber => string.IsNullOrEmpty(phoneNumber))     .Must(IsValidEmail)     .Must(CheckEmailIsInUseAsync).WithMessage(\"Email is already using\");  ...  \/\/\/ &lt;summary> \/\/\/ Check of email is valid. \/\/\/ &lt;\/summary> private static bool IsValidEmail(string? email) {     \/\/ Some sync logic. }  \/\/\/ &lt;summary> \/\/\/ Async check that email is already using. \/\/\/ &lt;\/summary> private static async Task&lt;bool> CheckEmailIsInUseAsync(string? email, CancellationToken cancellationToken) {     \/\/ Some async logic. }<\/code><\/pre>\n<p>\u0423 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0439 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u044f \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430:<\/p>\n<ol>\n<li>\n<p>\u041f\u043e\u043a\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u043c (\u0435\u0441\u043b\u0438 \u043d\u0435 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430). \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0436\u0434\u0430\u0442\u044c\u0441\u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 (\u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <code>Validator.WaitValidatingCompletedAsync<\/code>). \u041d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u0438\u043d\u0430\u0447\u0435 \u043c\u043e\u0436\u043d\u043e \u0436\u0434\u0430\u0442\u044c \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u0435\u043c\u0443 \u043d\u0435 \u043d\u0430\u0434\u043e\u0435\u0441\u0442 \u043c\u0435\u043d\u044f\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0416\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>CascadeMode.Stop<\/code> \u0434\u043b\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u0441 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0439 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0435\u0439. \u0418\u043d\u0430\u0447\u0435, \u0435\u0441\u043b\u0438 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0435\u0441\u0442\u044c \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0444\u043e\u0440\u043c\u0430\u0442\u0430 \u043d\u043e\u043c\u0435\u0440\u0430 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043a\u043e\u0439), \u0442\u043e \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0438 \u0441\u0435\u0440\u0432\u0435\u0440 \u043c\u043e\u0436\u0435\u0442 \u0432\u0435\u0440\u043d\u0443\u0442\u044c 400 \u043e\u0448\u0438\u0431\u043a\u0443.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0434\u043b\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u0442\u043e \u0432\u0441\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043f\u043e\u0441\u043b\u0435 \u043d\u0435\u0433\u043e \u0442\u0430\u043a\u0436\u0435 \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u043c\u0438 (\u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b <code>CascadeMode.Stop<\/code>) .<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u043c\u043d\u0438\u0442\u0435, \u0447\u0442\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u043e \u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0431\u044b\u0441\u0442\u0440\u043e \u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442 \u0441\u0432\u043e\u0439 \u043f\u043e\u0447\u0442\u043e\u0432\u044b\u0439 \u0430\u0434\u0440\u0435\u0441). \u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u0434\u043e\u043b\u0431\u0438\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438 \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u043d\u043e\u0432\u043e\u043c\u0443 \u0441\u0438\u043c\u0432\u043e\u043b\u0443, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Throttle (\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e <a href=\"https:\/\/github.com\/Karnah\/ReactiveValidation\/wiki\/Delay-before-validation-(property-throttling)\" rel=\"noopener noreferrer nofollow\">\u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0437\u0434\u0435\u0441\u044c<\/a>, \u0437\u0430 \u0438\u0434\u0435\u044e \u0441\u043f\u0430\u0441\u0438\u0431\u043e <a class=\"mention\" href=\"\/users\/wizme\">@WizMe<\/a>). \u0422\u0430\u043a\u0436\u0435 \u0432 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u043c\u0435\u0442\u043e\u0434 <code>Must<\/code> \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f <code>CancellationToken<\/code>, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043c\u0435\u043d\u044f\u0442\u044c \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0443\u0436\u0435 \u043d\u0435 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u0430 \u0438\u0437-\u0437\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430.  <\/p>\n<\/li>\n<\/ol>\n<h2>\u0412\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0430\u044f \u043b\u043e\u043a\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h2>\n<p>\u041b\u043e\u043a\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0431\u044b\u043b\u0430 \u0435\u0449\u0435 \u0432 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438, \u043d\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u044f \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u043b\u0441\u044f \u0435\u0451 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u043e\u0431\u043d\u043e\u0439.<\/p>\n<p>\u0412\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440\u044b \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u044f\u0437\u044b\u043a\u0438: \u0440\u0443\u0441\u0441\u043a\u0438\u0439, \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u0438\u0439, \u043d\u0435\u043c\u0435\u0446\u043a\u0438\u0439 \u0438 \u0447\u0435\u0448\u0441\u043a\u0438\u0439. \u041a\u0443\u043b\u044c\u0442\u0443\u0440\u0430 \u0431\u0435\u0440\u0451\u0442\u0441\u044f \u0438\u0437 <code>CultureInfo.CurrentUICulture<\/code>, \u0438\u043b\u0438 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u044f\u0432\u043d\u043e:<\/p>\n<pre><code class=\"cs\">ValidationOptions.LanguageManager.Culture = culture;<\/code><\/pre>\n<p>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u043b\u043e\u043a\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u044e\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c. \u0418\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440 <code>.resx<\/code> \u0444\u0430\u0439\u043b\u043e\u0432:<\/p>\n<pre><code class=\"cs\">ValidationOptions     .Setup()     .UseStringProvider(new ResourceStringProvider(         Samples.Resources.Default.ResourceManager,         new Dictionary&lt;string, ResourceManager>         {             { nameof(Samples.Resources.Additional), Samples.Resources.Additional.ResourceManager },         }));<\/code><\/pre>\n<p>\u041e\u043d \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e (<code>Default.ResourceManager<\/code>), \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 (\u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c <code>Additional<\/code>).<\/p>\n<blockquote>\n<p>\u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043b\u043e\u043a\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0430 \u0432 \u0444\u0430\u0439\u043b\u0430\u0445, \u0411\u0414 \u0438\u043b\u0438 \u0435\u0449\u0435 \u0433\u0434\u0435-\u0442\u043e, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 <code>ReactiveValidation.Resources.StringProviders.IStringProvider<\/code>.<\/p>\n<\/blockquote>\n<p>\u0421\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u044e\u0442\u0441\u044f \u0438\u0437 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430 \u043f\u043e \u043a\u043b\u044e\u0447\u0430\u043c:<\/p>\n<pre><code class=\"cs\">builder.RuleFor(vm => vm.Password)     .NotEmpty()     .MinLength(8, ValidationMessageType.Warning)         .WithLocalizedMessage(\"key\"); \/\/ \u0418\u043b\u0438. builder.RuleFor(vm => vm.Password)     .NotEmpty()     .MinLength(8, ValidationMessageType.Warning)         .WithLocalizedMessage(\"resource\", \"key\");<\/code><\/pre>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043c\u043e\u0436\u043d\u043e \u043b\u043e\u043a\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u0430 \u0441\u0432\u043e\u0439\u0441\u0442\u0432:<\/p>\n<pre><code class=\"cs\">[DisplayName(DisplayNameKey = \"key\")] public string? PhoneNumber { get; set; } \/\/ \u0418\u043b\u0438. [DisplayName(DisplayNameResource = \"resource\", DisplayNameKey = \"key\")] public string? PhoneNumber { get; set; }<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043c\u0435\u043d\u044f\u0442\u044c \u043a\u0443\u043b\u044c\u0442\u0443\u0440\u0443 &#171;\u043d\u0430 \u043b\u0435\u0442\u0443&#187;, \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u0435 \u044d\u0442\u043e \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445:<\/p>\n<pre><code class=\"cs\">ValidationOptions     .Setup()     .TrackCultureChanged();<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0442\u0430\u043a\u043e\u0439 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u043e\u0448\u0438\u0431\u043e\u043a. \u041e \u043d\u0451\u043c \u043d\u0438\u0436\u0435.<\/p>\n<h2>\u0428\u0430\u0431\u043b\u043e\u043d\u044b \u043e\u0448\u0438\u0431\u043e\u043a<\/h2>\n<p>\u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <code>INotifyPropertyChanged<\/code> \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043d\u0435 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0433\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u043b\u0438\u0441\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u0443\u0440\u043e\u0432\u043d\u0438 \u043e\u0448\u0438\u0431\u043e\u043a. \u0422\u0430\u043a\u0436\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0447\u0442\u043e \u0432 WPF, \u0447\u0442\u043e \u0432 Avalonia \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 <code>ToString<\/code>, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0435\u043a\u0441\u0442 \u043e\u0448\u0438\u0431\u043a\u0438, \u0438 \u044d\u0442\u043e \u043d\u0435 \u0434\u0430\u0451\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c Binding \u043d\u0430 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u043f\u0430\u043a\u0435\u0442\u0430\u0445 <code>ReactiveValidation.Wpf<\/code> \u0438 <code>ReactiveValidation.Avalonia<\/code> \u043e\u043d\u0438 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b.<\/p>\n<h3>Avalonia<\/h3>\n<blockquote>\n<p>\u0412 11 \u0432\u0435\u0440\u0441\u0438\u0438 \u0410\u0432\u0430\u043b\u043e\u043d\u0438\u0438 \u043e\u0447\u0435\u043d\u044c \u0441\u0438\u043b\u044c\u043d\u043e \u043c\u0435\u043d\u044f\u043b\u0438 \u0442\u0435\u043c\u044b. \u041f\u0440\u0438\u0447\u0451\u043c \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u044f \u0435\u0441\u0442\u044c \u0434\u0430\u0436\u0435 \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u0435\u0432\u044c\u044e \u0432\u0435\u0440\u0441\u0438\u0435\u0439 \u0438 \u0440\u0435\u043b\u0438\u0437 \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442. \u041f\u043e \u044d\u0442\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u0442\u0435\u043c\u0430 \u0434\u043b\u044f \u0410\u0432\u0430\u043b\u043e\u043d\u0438\u0438 \u0432\u0435\u0440\u0441\u0438\u0438 <code>0.10<\/code> \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f <code>ReactiveValidation.Avalonia<\/code> \u0434\u043e \u0432\u0435\u0440\u0441\u0438\u0438  2.0.3 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e. \u0412\u0435\u0440\u0441\u0438\u044f <code>2.0.4-pre<\/code> \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u0435\u0440\u0441\u0438\u044e Avalonia <code>11.0.0-rc1.1<\/code> \u0438 \u0432\u044b\u0448\u0435.<\/p>\n<\/blockquote>\n<p>\u041f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u0430\u044f \u0442\u0435\u043c\u0430:<\/p>\n<pre><code class=\"xml\">xmlns:rvThemes=\"clr-namespace:ReactiveValidation.Avalonia.Themes;assembly=ReactiveValidation.Avalonia\" ... &lt;Application.Styles>     &lt;FluentTheme \/>     &lt;rvThemes:FluentTheme \/> &lt;\/Application.Styles>  &lt;!-- or -->  &lt;Application.Styles>     &lt;default:SimpleTheme \/>     &lt;rvThemes:SimpleTheme \/> &lt;\/Application.Styles><\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u0446\u0432\u0435\u0442 \u043a\u0438\u0441\u0442\u0435\u0439, \u043e \u0442\u043e\u043c \u043a\u0430\u043a \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e <a href=\"https:\/\/github.com\/Karnah\/ReactiveValidation\/wiki\/Avalonia.-Error-templates\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>. <\/p>\n<h3>WPF<\/h3>\n<pre><code class=\"xml\">&lt;!-- \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432. --> &lt;Application.Resources>     &lt;ResourceDictionary>         &lt;ResourceDictionary.MergedDictionaries>             &lt;ResourceDictionary Source=\"\/ReactiveValidation.Wpf;component\/Themes\/Generic.xaml\" \/>         &lt;\/ResourceDictionary.MergedDictionaries>     &lt;\/ResourceDictionary> &lt;\/Application.Resources>  &lt;!-- \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d. --> &lt;TextBox Validation.ErrorTemplate=\"{StaticResource WpfErrorTemplate}\" \/> &lt;!-- \u0418\u043b\u0438 --> &lt;TextBox Validation.ErrorTemplate=\"{StaticResource ExtendedErrorTemplate}\" \/>  &lt;!-- \u0418\u043b\u0438 \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u0441\u0442\u0438\u043b\u0438. --> &lt;Style TargetType=\"TextBox\">     &lt;Setter Property=\"Validation.ErrorTemplate\" Value=\"{StaticResource WpfErrorTemplate}\" \/> &lt;\/Style> &lt;!-- \u0418\u043b\u0438 --> &lt;Style TargetType=\"TextBox\">     &lt;Setter Property=\"Validation.ErrorTemplate\" Value=\"{StaticResource ExtendedErrorTemplate}\" \/> &lt;\/Style><\/code><\/pre>\n<p>\u0411\u043e\u043b\u044c\u0448\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043f\u0440\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0438 \u0438\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 <a href=\"https:\/\/github.com\/Karnah\/ReactiveValidation\/wiki\/WPF.-Error-templates\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0411\u043e\u043b\u044c\u0448\u043e\u0435 \u0441\u043f\u0430\u0441\u0438\u0431\u043e \u0432\u0441\u0435\u043c, \u043a\u0442\u043e \u0434\u043e\u0447\u0438\u0442\u0430\u043b \u0434\u043e \u043a\u043e\u043d\u0446\u0430. \u0411\u0443\u0434\u0443 \u0440\u0430\u0434 \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441\u044b, \u0443\u0441\u043b\u044b\u0448\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u044f (\u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043e\u0440\u0444\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0435\/\u043f\u0443\u043d\u043a\u0442\u0443\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438).<\/p>\n<p>\u0421\u0441\u044b\u043b\u043a\u0438:<\/p>\n<ol>\n<li>\n<p><a href=\"https:\/\/github.com\/Karnah\/ReactiveValidation\" rel=\"noopener noreferrer nofollow\">\u041f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430 GitHub<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/Karnah\/ReactiveValidation\/wiki\" rel=\"noopener noreferrer nofollow\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a><\/p>\n<\/li>\n<li>\n<p>Nuget \u043f\u0430\u043a\u0435\u0442\u044b \u0434\u043b\u044f <a href=\"https:\/\/ReactiveValidation.Avalonia\" rel=\"noopener noreferrer nofollow\">Avalonia 0.10<\/a> \u0438 <a href=\"https:\/\/www.nuget.org\/packages\/ReactiveValidation.Avalonia\/2.0.4-pre\" rel=\"noopener noreferrer nofollow\">Avalonia 11<\/a><\/p>\n<\/li>\n<li>\n<p>Nuget \u043f\u0430\u043a\u0435\u0442 \u0434\u043b\u044f <a href=\"https:\/\/www.nuget.org\/packages\/ReactiveValidation.Wpf\" rel=\"noopener noreferrer nofollow\">WPF<\/a><\/p>\n<\/li>\n<\/ol>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/749058\/\"> https:\/\/habr.com\/ru\/articles\/749058\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442!<\/p>\n<p>5 \u043b\u0435\u0442 \u043d\u0430\u0437\u0430\u0434 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043b, \u043a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043b <a href=\"https:\/\/habr.com\/ru\/articles\/354886\/\" rel=\"noopener noreferrer nofollow\">\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0434\u043b\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 WPF<\/a>. \u0412\u0441\u0451 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u043b\u0441\u044f \u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u0442 \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u0440\u0443\u0433\u043e\u0439 \u0434\u0435\u0441\u043a\u0442\u043e\u043f \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a &#8212; <a href=\"https:\/\/avaloniaui.net\/\" rel=\"noopener noreferrer nofollow\">Avalonia UI<\/a>. \u041c\u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0442\u0430\u043a\u0436\u0435 \u0438 \u0435\u0433\u043e, \u0447\u0442\u043e \u0438 \u0431\u044b\u043b\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438. \u041f\u043e\u043c\u0438\u043c\u043e \u044d\u0442\u043e\u0433\u043e, \u0442\u0443\u0434\u0430 \u0432\u043e\u0448\u043b\u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u0444\u0438\u0447\u0438.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u0431\u044b\u043b\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u0435\u0440\u0435\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e (\u0442\u0435\u043c \u0431\u043e\u043b\u0435\u0435, \u043c\u043d\u043e\u0433\u043e\u0435 \u043f\u043e\u043c\u0435\u043d\u044f\u043b\u043e\u0441\u044c \u0441 \u0442\u0435\u0445 \u043f\u043e\u0440), \u0437\u0434\u0435\u0441\u044c \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0441\u0451, \u0447\u0442\u043e \u0443\u043c\u0435\u0435\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442.<\/p>\n<figure class=\"full-width\">\n<div><figcaption>FluentTheme \u043e\u0442 Avalonia \u0441 \u0440\u0430\u0437\u043d\u043e\u0433\u043e \u0440\u043e\u0434\u0430 \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438<\/figcaption><\/div>\n<\/figure>\n<blockquote>\n<p>\u041d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0441 \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u0432\u044b\u0445\u043e\u0434\u0430 \u043f\u0435\u0440\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043e\u0442 ReactiveUI &#8212;  <a href=\"https:\/\/github.com\/reactiveui\/ReactiveUI.Validation\" rel=\"noopener noreferrer nofollow\">ReactiveUI.Validation<\/a>. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 <code>ReactiveValidation<\/code> \u0442\u0430\u043a\u0436\u0435 \u0431\u0443\u0434\u0443\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044e.<\/p>\n<\/blockquote>\n<h2>\u0417\u0430\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u0430\u0432\u0438\u043b<\/h2>\n<p>\u041f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u043b\u0430 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 <a href=\"https:\/\/github.com\/FluentValidation\/FluentValidation\" rel=\"noopener noreferrer nofollow\">FluentValidation<\/a>, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d\u0430 \u0438\u043c\u0435\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u0438 \u043b\u0435\u0433\u043a\u043e \u0447\u0438\u0442\u0430\u0435\u043c\u044b\u0439 fluent-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u043e\u0439\u043a\u0438 \u043f\u0440\u0430\u0432\u0438\u043b. \u042d\u0442\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u0440\u0430\u0437\u043e\u0432\u043e\u0439 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e web-\u0437\u0430\u043f\u0440\u043e\u0441\u0430), \u043d\u043e \u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f (\u043a\u0430\u043a \u044d\u0442\u043e \u0447\u0430\u0441\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u0434\u0435\u0441\u043a\u0442\u043e\u043f\u0435).<\/p>\n<p>\u041f\u043e \u044d\u0442\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u0432\u0441\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u0434\u043b\u044f <code>ReactiveValidation<\/code> \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u0441 \u043d\u0443\u043b\u044f. \u041e\u043d\u0430 \u0441\u0440\u0430\u0437\u0443 \u0437\u0430\u0432\u044f\u0437\u0430\u043d\u0430 \u043d\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0435 <a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/system.componentmodel.inotifypropertychanged?view=net-7.0\" rel=\"noopener noreferrer nofollow\">INotifyPropertyChanged<\/a> \u0438 <a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/system.componentmodel.inotifydataerrorinfo?view=net-7.0\" rel=\"noopener noreferrer nofollow\">INotifyDataErrorInfo<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043a\u0430\u043a \u0432 WPF, \u0442\u0430\u043a \u0438 \u0432 Avalonia, \u0447\u0442\u043e\u0431\u044b \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 UI. \u041d\u043e \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0432\u043e \u043c\u043d\u043e\u0433\u043e\u043c \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442 <code>FluentValidation<\/code>:<\/p>\n<pre><code class=\"cs\">builder.RuleFor(vm => vm.PhoneNumber)     .NotEmpty()         .When(vm => Email, email => string.IsNullOrEmpty(email))         .WithMessage(\"You need to specify a phone or email\")     .Matches(@\"^\\d{11}$\")         .WithMessage(\"Phone number must contain 11 digits\");  builder.RuleFor(vm => vm.Email)     .NotEmpty()         .When(vm => PhoneNumber, phoneNumber => string.IsNullOrEmpty(phoneNumber))         .WithMessage(\"You need to specify a phone or email\")     .Must(IsValidEmail)         .WithMessage(\"Not valid email\");   builder.RuleFor(vm => vm.Password)     .NotEmpty()     .MinLength(8, ValidationMessageType.Warning)         .WithMessage(\"For a secure password, enter more than {MinLength} characters. You entered {TotalLength} characters\");  builder.RuleFor(vm => vm.ConfirmPassword)     .Equal(vm => vm.Password);   builder.RuleFor(vm => vm.Country)     .NotEmpty()     .AllWhen(vm => vm.AdditionalInformation);  builder.RuleFor(vm => vm.City)     .NotEmpty()     .AllWhen(vm => vm.AdditionalInformation);<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435, \u043a\u0430\u043a \u0438 \u0434\u043b\u044f <code>FluentValidation<\/code>, \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>NotEmpty<\/code>, <code>Matches<\/code>, <code>MinLength<\/code>, <code>Must<\/code>). \u0415\u0441\u043b\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u043e\u0441\u043e\u0431\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u0445, \u0442\u043e \u0435\u0441\u0442\u044c <code>When<\/code>. \u0427\u0442\u043e\u0431\u044b \u0437\u0430\u0434\u0430\u0442\u044c \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0434\u043b\u044f \u0432\u0441\u0435\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u043f\u0440\u0430\u0432\u0438\u043b, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>AllWhen<\/code>. \u0414\u043b\u044f \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0442\u0435\u043a\u0441\u0442\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>WithMessage<\/code> \/ <code>WithLocalizedMessage<\/code>. \u0427\u0442\u043e\u0431\u044b \u0437\u0430\u0434\u0430\u0442\u044c \u0432\u0430\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <code>ValidationMessageType<\/code> (\u0447\u0442\u043e\u0431\u044b <code>Warning<\/code> \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u043b\u0441\u044f \u043e\u0440\u0430\u043d\u0436\u0435\u0432\u044b\u043c \u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d\u044b, \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0432 \u0441\u0430\u043c\u043e\u043c \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438).<\/p>\n<blockquote>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0432\u0430\u0436\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442. \u0415\u0441\u043b\u0438 \u0432 \u043f\u0440\u0430\u0432\u0438\u043b\u0435 \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u0442\u043e \u0435\u0433\u043e \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043a\u0430\u043a \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0441 <code>When(vm => Email, email => string.IsNullOrEmpty(email))<\/code>. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440 \u0431\u0443\u0434\u0435\u0442 \u0437\u043d\u0430\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u0443 \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d\u043e \u0434\u0432\u0430 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 (<code>PhoneNumber<\/code> \u0438 <code>Email<\/code> ), \u0438 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0435\u0433\u043e \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u043b\u044e\u0431\u043e\u0433\u043e \u0438\u0437 \u043d\u0438\u0445.<\/p>\n<\/blockquote>\n<h2>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440\u0430 \u0434\u043b\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430<\/h2>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u043b\u0438\u0441\u044c \u0434\u043b\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e:<\/p>\n<ol>\n<li>\n<p>\u0423\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u0432\u0430\u043b\u0438\u0434\u0438\u0440\u0443\u0435\u043c\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u043e\u0442 <code>ValidatableObject<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <code>Validator<\/code>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f <code>ValidationBuilder&lt;T><\/code>.<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"cs\">public class BaseSampleViewModel : ValidatableObject {     public BaseSampleViewModel()     {         Validator = GetValidator();     }      private IObjectValidator GetValidator()     {         var builder = new ValidationBuilder&lt;BaseSampleViewModel>();         \/\/ \u0417\u0434\u0435\u0441\u044c \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u0430.                             return builder.Build(this);     }      \/\/ \u0421\u0432\u043e\u0439\u0441\u0442\u0432\u0430 BaseSampleViewModel \u0441 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 INotifyPropertyChanged. }<\/code><\/pre>\n<blockquote>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 WPF, \u0442\u043e \u0432\u043e View \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 <code>AdornerDecorator<\/code> (<a href=\"https:\/\/github.com\/Karnah\/ReactiveValidation\/wiki\/WPF.-Quick-start#step-4-configure-your-view\" rel=\"noopener noreferrer nofollow\">\u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u0442\u0443\u0442<\/a>). \u0412 Avalonia \u0432\u0441\u0451 \u0443\u0436\u0435 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043e \u0432 \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0441\u0442\u0438\u043b\u0438, \u0438 \u043d\u0438\u0447\u0435\u0433\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430 \u043d\u0430\u0434\u043e (\u0437\u0430 \u0447\u0442\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u043e\u043a\u043b\u043e\u043d \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c).<\/p>\n<\/blockquote>\n<blockquote>\n<p>\u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441, \u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <code>IValidatableObject<\/code>. \u0421\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e, <a href=\"https:\/\/github.com\/Karnah\/ReactiveValidation\/wiki\/Inheriting-your-class-from-IValidatableObject\" rel=\"noopener noreferrer nofollow\">\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0437\u0434\u0435\u0441\u044c<\/a>. <\/p>\n<\/blockquote>\n<p>\u0411\u043e\u043b\u044c\u0448\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u0412\u043d\u0443\u0442\u0440\u0438 <code>ValidatableObject<\/code> \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0432\u0441\u044f \u043b\u043e\u0433\u0438\u043a\u0430, \u0447\u0442\u043e\u0431\u044b View \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0430\u0445. \u041f\u043e\u043b\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 ViewModel \u043c\u043e\u0436\u043d\u043e <a href=\"https:\/\/github.com\/Karnah\/ReactiveValidation\/blob\/master\/src\/ReactiveValidation.Avalonia.Samples\/1.%20BaseSample\/BaseSampleViewModel.cs\" rel=\"noopener noreferrer nofollow\">\u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0437\u0434\u0435\u0441\u044c<\/a>. <\/p>\n<p>\u0412 \u043d\u043e\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 <code>ReactiveValidation<\/code> \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0441\u044f \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u0439 \u0434\u043b\u044f <code>FluentValidation<\/code> \u0441\u043f\u043e\u0441\u043e\u0431 \u0437\u0430\u0434\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435:<\/p>\n<pre><code class=\"cs\">public class YourViewModelValidation : ValidationRuleBuilder&lt;YourViewModel> {     public YourViewModelValidation()     {         RuleFor(vm => vm.Name)             .NotEmpty()             .MaxLength(16)             .NotEqual(\"foo\");          RuleFor(vm => vm.Surname)             .Equal(\"foo\");          RuleFor(vm => vm.PhoneNumber)             .NotEmpty(ValidationMessageType.Warning)             .Matches(@\"^\\d{9,12}$\");     } }<\/code><\/pre>\n<p>\u0422\u043e\u0433\u0434\u0430 \u0441\u0430\u043c \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438:<\/p>\n<pre><code class=\"cs\">\/\/ \u042d\u0442\u043e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 YourViewModel. public YourViewModel(IValidatorFactory validatorFactory) {     \/\/ \u041f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441\u0430.     Validator = new YourViewModelValidation().Build(this);      \/\/ \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0431\u0440\u0438\u043a\u0443-\u0441\u0438\u043d\u0433\u043b\u0442\u043e\u043d.     Validator = ValidationOptions.ValidatorFactory.GetValidator(this);      \/\/ \u0417\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0431\u0440\u0438\u043a\u0443 \u0432 DI \u0438 \u043f\u0440\u043e\u043a\u0438\u0434\u044b\u0432\u0430\u0442\u044c \u0435\u0451 \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440.     Validator = validatorFactory.GetValidator(this); }<\/code><\/pre>\n<p>\u041f\u0440\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044e \u0444\u0430\u0431\u0440\u0438\u043a\u0438 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043c\u043e\u0436\u043d\u043e <a href=\"https:\/\/github.com\/Karnah\/ReactiveValidation\/wiki\/Separate-validation-classes-and-validator-factory\" rel=\"noopener noreferrer nofollow\">\u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0442\u0443\u0442<\/a>.<\/p>\n<h2>\u041f\u0440\u0430\u0432\u0438\u043b\u0430 \u0434\u043b\u044f \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432<\/h2>\n<p>\u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0448\u0435\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435:<\/p>\n<ul>\n<li>\n<p>\u0441\u0430\u043c\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0442 <code>INotifyDataErrorInfo<\/code> \u0438\u043b\u0438 <code>IValidatableObject<\/code><\/p>\n<\/li>\n<li>\n<p>\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f\u043c\u0438, \u0430 \u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0442<code>INotifyDataErrorInfo<\/code> \u0438\u043b\u0438 <code>IValidatableObject<\/code>,<\/p>\n<\/li>\n<\/ul>\n<p>\u0442\u043e\u0433\u0434\u0430 \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u0434\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u043f\u0440\u043e\u0449\u0430\u044e\u0442 \u0440\u0430\u0431\u043e\u0442\u0443.<\/p>\n<pre><code class=\"cs\">builder.RuleFor(vm => vm.InnerObjectValue)     .SetValueValidator(GetInnerObjectValidator)     .NotNull()     .ModelIsValid();  builder.RuleForCollection(vm => vm.InnerObjectsCollection)     .SetCollectionItemValidator(GetInnerObjectValidator)     .NotNull()     .Count(3, 5)     .CollectionElementsAreValid();<\/code><\/pre>\n<p>\u0420\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u043f\u043e \u0432\u044b\u0437\u043e\u0432\u0430\u043c:<\/p>\n<ol>\n<li>\n<p><code>SetValueValidator(GetInnerObjectValidator)<\/code>, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 <code>InnerObjectValue<\/code> \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0441\u044f \u043e\u0442 <code>IValidatableObject<\/code>. \u0414\u043b\u044f \u043b\u044e\u0431\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d \u0432 <code>InnerObjectValue<\/code>, \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 <code>GetInnerObjectValidator<\/code> (\u043c\u0435\u0442\u043e\u0434 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0435 \u0432\u044b &#8212; \u043c\u043e\u0436\u043d\u043e \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440 \u0432\u0440\u0443\u0447\u043d\u0443\u044e, \u0442\u0430\u043a \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0431\u0440\u0438\u043a\u0443).<\/p>\n<\/li>\n<li>\n<p><code>ModelIsValid()<\/code> , \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438  <code>InnerObjectValue<\/code>  \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0441\u044f \u043e\u0442  <code>INotifyDataErrorInfo<\/code>. \u0415\u0441\u043b\u0438 \u043e\u0431\u044a\u0435\u043a\u0442<code>InnerObjectValue<\/code> \u043d\u0435 \u0432\u0430\u043b\u0438\u0434\u0435\u043d, \u0442\u043e \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0442\u0430\u043a\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435 \u0432\u0430\u043b\u0438\u0434\u0435\u043d.<\/p>\n<\/li>\n<li>\n<p><code>SetCollectionItemValidator(GetInnerObjectValidator)<\/code>, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u044e\u0442\u0441\u044f \u043e\u0442 <code>IValidatableObject<\/code>. \u041f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u0441 \u043f. 1 &#8212; \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440. \u0415\u0441\u043b\u0438 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442 <a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/system.collections.specialized.inotifycollectionchanged?view=net-7.0\" rel=\"noopener noreferrer nofollow\">INotifyCollectionChanged<\/a>, \u0442\u043e \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440\u044b \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0445 \u0432 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p><code>CollectionElementsAreValid()<\/code>, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u044e\u0442\u0441\u044f \u043e\u0442 <code>INotifyDataErrorInfo<\/code>. \u0427\u0442\u043e\u0431\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0440\u044b\u0445 &#8212; \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u0441 <code>INotifyCollectionChanged<\/code>, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/system.collections.objectmodel.observablecollection-1?view=net-7.0\" rel=\"noopener noreferrer nofollow\">ObservableCollection&lt;T><\/a>.<\/p>\n<\/li>\n<\/ol>\n<h2>\u041a\u0430\u0441\u043a\u0430\u0434\u043d\u044b\u0439 \u0440\u0435\u0436\u0438\u043c<\/h2>\n<p>\u0422\u043e\u0436\u0435 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u0430\u044f \u0434\u043b\u044f <code>FluentValidation<\/code> \u0432\u0435\u0449\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0432 \u043d\u043e\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 <code>ReactiveValidation<\/code>. \u0415\u0441\u043b\u0438 \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0437\u0430\u0434\u0430\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0430\u0432\u0438\u043b, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u0440\u0435\u0436\u0438\u043c \u0438\u0445 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438:<\/p>\n<ol>\n<li>\n<p><code>CascadeMode.Continue<\/code> (\u0440\u0435\u0436\u0438\u043c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e) &#8212; \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442\u0441\u044f \u0432\u0441\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0434\u043b\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430. \u041d\u0430 \u044d\u043a\u0440\u0430\u043d \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u0435\u0441\u044c \u0441\u043f\u0438\u0441\u043e\u043a.<\/p>\n<\/li>\n<li>\n<p><code>CascadeMode.Stop<\/code> &#8212; \u0435\u0441\u043b\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0432\u0435\u0440\u043d\u0443\u043b\u043e \u043e\u0448\u0438\u0431\u043a\u0443, \u0442\u043e \u0432\u0441\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u044e\u0442\u0441\u044f.<\/p>\n<\/li>\n<\/ol>\n<p>\u0420\u0435\u0436\u0438\u043c \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c:<\/p>\n<ol>\n<li>\n<p>\u0414\u043b\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"cs\">builder.RuleFor(vm => vm.Email)     .WithPropertyCascadeMode(CascadeMode.Stop)     .NotEmpty().When(vm => vm.PhoneNumber, phoneNumber => string.IsNullOrEmpty(phoneNumber))     .Must(IsValidEmail);<\/code><\/pre>\n<ol start=\"2\">\n<li>\n<p>\u0414\u043b\u044f \u0431\u0438\u043b\u0434\u0435\u0440\u0430:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"cs\">builder.PropertyCascadeMode = CascadeMode.Stop;  \/\/ \u0418\u043b\u0438, \u0435\u0441\u043b\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0437\u0430\u0434\u0430\u044e\u0442\u0441\u044f \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435. PropertyCascadeMode = CascadeMode.Stop;<\/code><\/pre>\n<ol start=\"3\">\n<li>\n<p>\u0413\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e:<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"cs\">ValidationOptions     .Setup()     .UsePropertyCascadeMode(CascadeMode.Stop);<\/code><\/pre>\n<h2>\u0422\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0442\u0438\u043f\u043e\u0432 \u0441\u0432\u043e\u0439\u0441\u0442\u0432<\/h2>\n<p>\u041d\u0435\u0440\u0435\u0434\u043a\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f, \u043a\u043e\u0433\u0434\u0430 \u0447\u0438\u0441\u043b\u043e \u0432\u043e ViewModel \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u043a <code>string<\/code> \u0438 \u043f\u0440\u0438\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a <code>TextBox<\/code>. \u041d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0432\u0430\u043b\u0438\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u043a\u0430\u043a \u0447\u0438\u0441\u043b\u043e \u0438, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043d\u0430\u0432\u0435\u0441\u0438\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 <code>Transform<\/code>:<\/p>\n<pre><code class=\"cs\">builder     .TransformToInt(vm => vm.AgeString)     .NotNull().WithMessage(\"Age should be valid integer string\")     .Between(18, 35);<\/code><\/pre>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438:<\/p>\n<ol>\n<li>\n<p>\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0438\u0437 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 short, ushort, int, uint, long, ulong, float, double, decimal.<\/p>\n<\/li>\n<li>\n<p>\u041c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438:<code>Func&lt;TObject, TProp, TPropTransformed> transformer<\/code>\u00a0\u0438\u043b\u0438<code>Func&lt;TProp, TPropTransformed> transformer<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u041c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0432 \u043e\u0442 <code>ReactiveValidation.Validators.PropertyValueTransformers.IValueTransformer&lt;in TObject, out TTo><\/code>.<\/p>\n<\/li>\n<\/ol>\n<h2>\u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u0430\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f<\/h2>\n<p>\u0412 \u043d\u043e\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430. \u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u044d\u0442\u043e \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cs\">builder.RuleFor(vm => vm.Email)     .NotEmpty().When(vm => vm.PhoneNumber, phoneNumber => string.IsNullOrEmpty(phoneNumber))     .Must(IsValidEmail)     .Must(CheckEmailIsInUseAsync).WithMessage(\"Email is already using\");  ...  \/\/\/ &lt;summary> \/\/\/ Check of email is valid. \/\/\/ &lt;\/summary> private static bool IsValidEmail(string? email) {     \/\/ Some sync logic. }  \/\/\/ &lt;summary> \/\/\/ Async check that email is already using. \/\/\/ &lt;\/summary> private static async Task&lt;bool> CheckEmailIsInUseAsync(string? email, CancellationToken cancellationToken) {     \/\/ Some async logic. }<\/code><\/pre>\n<p>\u0423 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0439 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u044f \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430:<\/p>\n<ol>\n<li>\n<p>\u041f\u043e\u043a\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f<\/p>\n<\/li>\n<\/ol>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-350541","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/350541","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=350541"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/350541\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=350541"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=350541"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=350541"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}