How to integrate EnterpriseResults application block validation between WCF and ASP.NET?

The Application Validation Application (VAB) block is integrated with ASP.NET as well as with WCF.

Is there a way to integrate ValidationResults created in WCF using ASP.NET?

eg. The ASP.NET web page calls the WCF service. The WCF service validates data using VAB and returns validation information through FaultContract. An ASP.NET page may accept results and display some error messages. However, a general approach is to indicate which fields have errors (for example, an inline message or an asterisk). It seems that most of these approaches will be related to the ability to compare the result of the verification with the control or with the help of a validator.

I don’t think there is a solution out of the box, but it was curious if someone did this and what their approach was.

+2
source share
1 answer

Since there is no ready-made solution, and there are no messages on it, I will share what I implemented. I do not like this approach, but it works for me.

Overview

, ASP.NET DataContract ClientId . ClientId asp.net FaultContract. FaultException; ASP.NET ClientId , , (, ).

DataContract , . ASP.NET. - DataContract, ClientId . DataContract.

ValidationResult , Target, , . ValidationResult , , , . ValidationResult , ASP.NET .

ValidationResult ASP.NET(ClientId) Target ValidationResult. ValidationResult. , readonly, , ValidationResult .

ValidationResults CustomValidationResults ( , ValidationResult), . CustomValidationResults ValidationFault FaultException.

ValidationFaults FaultException ASP.NET. ValidationFault ClientId , , .

+3

Source: https://habr.com/ru/post/1727557/


All Articles