Click here to Skip to main content
16,019,614 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Friends,


I want to implement selfValidation using the Microsoft Enterprise Library 5.0. Could you please help me out to over come the problem.


here is the reference code.

Business Objects

[HasSelfValidation]
public class Order
{
private int orderNo
private DateTime orderDate
...

[SelfValidation]
public void ValidateEntity(ValidationResults Results)
{
 if (orderDate==null)
 {
  results.AddResult(new ValidationResult("Order Date should not be null",this,orderDate, null, null));
 }
}
} 


This object is exposted through the WCF services to the client application
...

Client Application

OrderClient objOrderClient = new OrderClient();
            OrderClient.Open();
            Order objOrder = new Order()
             objOrder.OrderNo =1;

ValidationResults results = Validation.Validate(objOrder);

            if (!results.IsValid)
            {
                foreach (ValidationResult result in results)
                {
                    MessageBox.Show(result.Message);
                }
            }



This function ValidateEntity() is not calling and following error is raised :

'There is no source code available for the current location'

Could you please guide me how to implement the selfValidation.

Thanks
Posted
Updated 19-Jun-10 1:48am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900